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