Re: how to store node in variable?
How do I store a reference to a node in a variable
Only in the select= attribute.
or what am I doing wrong? Here is what I have (maybe oversimplified) :
Right ... because it is a result tree fragment, not 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.
Not sure why, but you'd get a copy of the node, not the node itself, so you would lose the context, so that wouldn't help (and it wouldn't be pure XSLT).
Alternatively, is there any way to explicitly set the context node without using for-each?
I would use:
<xsl:variable name="condition" select="<some condition>"/> <xsl:variable name="me" select="../self::*[$condition] | self::*[not($condition)]"/>
Only one of the union would be in the result because the condition is true exactly once.
I hope this helps.
-- 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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format