|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Using variables to determine nodesets with conditi
Hi Paulo,
> I'm beginning to use variables to determine criteria for selecting nodes
> with
> <xsl:for-each select="*[local-name() = $nodename]"/>
>
> Nevertheless, this doesn't work if '$nodename' is a nodeset with a
> condition, for example:
> <xsl:variable name="nodename">PEOPLE/PERSON[NAME != 'Carlos']</xsl:variable>
In the above variable declaration, the $nodename variable is set to a
result tree fragment whose string value is "PEOPLE/PERSON[NAME !=
'Carlos']". If you want to set it to contain a node-set, then you
should use the select attribute of <xsl:variable>, not its content:
<xsl:variable name="nodename"
select="PEOPLE/PERSON[NAME != 'Carlos']" />
When you set a variable using the select attribute, the XPath
expression held in the select attribute is evaluated and the variable
is set to the result. In this case, the $nodename variable to the
node-set of <PERSON> elements whose <NAME> element child is not equal
to 'Carlos'.
On the other hand, when you set a variable using its content, the
content is treated as a content constructor; any literal text is used
to create a text node, not evaluated as an XPath expression.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








