Subject: Re: [xsl] xsl:variable and key From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 10 Jun 2004 23:52:32 -0400 |
I want to assign a node-set returned by key() to a variable.
This works fine : <xsl:variable name="foo" select="key('XXX', YYY)"/>
But now I have a condition and I have to use <xsl:choose>.
And in such case I am not able to set the variable. The pseudo for what I want is something like this: <xsl:variable name="foo"> <xsl:choose> <xsl:when test="SOME-TEST"> SELECT node-set returned by key('XXX', YYY) </xsl:when> <xsl:otherwise> SELECT node-set ancestor::*[1] <xsl:otherwise> </xsl:choose> </xsl:variable>
Any suggesstions?
<xsl:variable name="foo" select="key('XXX',YYY)[SOME-TEST] | ancestor::*[1][not(SOME-TEST)]"/>
<xsl:variable name="test" select="SOME-TEST"/> <xsl:variable name="foo" select="key('XXX',YYY)[$test] | ancestor::*[1][not($test)]"/>
-- Public training 3 days XSLT & 2 days XSL-FO: Phoenix,AZ 2004-08-23 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] xsl:variable and key, M. David Peterson | Thread | XPathAPI question, Ling Kok Choon |
RE: [xsl] xsl:variable and key, M. David Peterson | Date | RE: [xsl] Building a hierarchy base, M. David Peterson |
Month |