[XSL-LIST Mailing List Archive Home]
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?
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
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.
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:
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list