Subject: Re: [xsl] Using variables to determine nodesets with conditions From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 23 Sep 2003 12:29:46 +0100 |
> Nevertheless, this doesn't work if '$nodename' is a nodeset with a > condition, for example: Nodestes themselves don't have conditions, although a condition may have been used to select the nodes. the variable stores the result (the set of nodes) not the expression used to select it. It does work, local-name() = $nodename is a string valued equality test so $node-name will be coerced to a string by taking the string value of the first node in document order in the set and comparing it with local-name(). Howevr the variable binding you showed does not generate a nodeset at all. <xsl:variable name="nodename">PEOPLE/PERSON[NAME != 'Carlos']</xsl:variable> just makes a result tree fragment with a root node and a text node with the string "PEOPLE/PERSON[NAME != 'Carlos']" there is no way in XSLT to evaluate an Xpath that is contained in a string, although some systems have extension functions to do that. However perhaps you want the node set selected by that expressuion, which would be <xsl:variable name="nodename" select="PEOPLE/PERSON[NAME != 'Carlos'"/> then <xsl:for-each select="*[local-name() = $nodename]"/> would work and be the same as <xsl:for-each select="*[local-name() = current()/PEOPLE/PERSON[NAME != 'Carlos']]"/> which would select all teh child elements whose local name was teh same as the string value of the first PEOPLE/PERSON child whose NAME was not Carlos. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] EXSL <func:result> return, Michael Kay | Thread | RE: [xsl] Using variables to determ, Michael Kay |
Re: [xsl] The best option?, David Carlisle | Date | Re: [xsl] The best option?, Emmanuil Batsis (Man |
Month |