Subject: Re: [xsl] how to store node in variable? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 21 Oct 2004 17:38:53 -0400 |
Sorry to trouble the list with this one which seems so simple and yet somehow I am banging my head against the wall for hours and I can't even think what to search for. The worst part is I think I've done this before...
How do I store a reference to a node in a variable or what am I doing wrong? Here is what I have (maybe oversimplified) :
<xsl:variable name="me"> <xsl:choose> <xsl:when test="<some condition>"> <xsl:copy-of select=".." /> </xsl:when> <xsl:otherwise> <xsl:copy-of select="." /> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:call-template name="<some template>"> <xsl:with-param name="myid" select="$me/@id" /> </xsl:call-template>
The with-param is always throwing an error, expression should result in a node-set.
<xsl:variable name="me"> <xsl:copy-of select="/set/node"/> </xsl:variable>
<xsl:variable name="condition" select="boolean( ... your conditional ...)"/> <xsl:variable name="me" select="self::node()[$condition] | parent::node()[not($condition)]"/>
If I add msxsl:node-set around my selects in the variable definition I get cannot convert result tree fragment to node-set.
Alternatively, is there any way to explicitly set the context node without using for-each?
I hope this helps, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how to store node in vari, John | Thread | [xsl] Copy one element from one xml, Nishi Bhonsle |
Re: [xsl] Applying Templates to a S, G. Ken Holman | Date | Re: [xsl] match string, Anton Triest |
Month |