[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Making XPath expressions out of variables
Subject: Re: [xsl] Making XPath expressions out of variables From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 29 Oct 2003 13:42:53 GMT |
> Is there a way of selecting nodes which have the name $some-variable using an > XPath expression? <xsl:for-each select="//$some-variable"> doesn't work as you can't have a string following //, if some-variable contains the string 'foo' you can use $some-variable in exactly the places that you can use 'foo'. It's strange why this comes up so often, it must be something to do with the $ syntax, i'm sure that in other programming lists people don't expect to be able to go op = "+"; 3 op 5; and get 8. What you want is <xsl:for-each select="//*[name()=$some-variable"]> What you want here <xsl:if test="$lh-operator $operand $rh-operator"> may be as you suggestan xsl:choose on the possible operators. Although it depends what you actually want. Actually I can'tt hink of any postfix operators in XPath so what do you have in mind for $rh-operator ? Some XSLT engines (eg saxon) have an evaluate extension function that will evaluate a string as an Xpath expression, which you could also use. David -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ 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 -> |
---|---|---|
[xsl] Making XPath expressions out , Richard Lewis | Thread | Re: [xsl] Making XPath expressions , Richard Lewis |
RE: [xsl] Making XPath expressions , Jarno . Elovirta | Date | RE: [xsl] Making XPath expressions , Sergiu Ignat |
Month |