[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Making XPath expressions out of variables
> 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
|
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
|