Subject: Re: [xsl] how to store node in variable? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 21 Oct 2004 23:26:01 +0300 |
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.
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?
<xsl:variable name="condition" select="<some condition>"/> <xsl:variable name="me" select="../self::*[$condition] | self::*[not($condition)]"/>
-- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how to store node in vari, Joe Fawcett | Thread | Re: [xsl] how to store node in vari, John |
Re: [xsl] how to store node in vari, Joe Fawcett | Date | Re: [xsl] How to put in a variable , G. Ken Holman |
Month |