[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Making XPath expressions out of variables

Subject: RE: Making XPath expressions out of variables
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 29 Oct 2003 16:03:42 -0000
xpath expression with variables
You either need to generate the whole stylesheet before you start, or
you need to make extensive use of the xx:evaluate() extension function
(and an XSLT processor that supports it).

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Richard Lewis
> Sent: 29 October 2003 13:09
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Making XPath expressions out of variables
> 
> 
> This is a theoretical bit of XSL code which I need a 
> practical version of:
> 
> All the variables are passed as parameters to the stylesheet.
> 
> <xsl:for-each select="//$record-type">
> 	<xsl:sort select="$sort-by" order="$sort-order" />
> 	<xsl:if test="$lh-operator $operand $rh-operator">
> 		<tr>
>  			<xsl:for-each select="*">
> 				<td><xsl:value-of select="." /></td>
> 			</xsl:for-each>
> 		</tr>
> 	</xsl:if>
> </xsl:for-each>
> 
> Any ideas? Is it possible? Or do I need to use this basic 
> construct multiple 
> times using <xsl:if> for each variable and the correct names 
> of nodes and 
> operands. (The number of permutations is massive!)
> 
> Cheers,
> Richard
> -------------------------------------------------------------
> This is question I was going to ask (it might make things clearer):
> 
> Is there a way of selecting nodes which have the name 
> $some-variable using an 
> XPath expression?
> 
> e.g. <xsl:for-each select="//$some-variable">
> 
> would, in theory (though not in practice - I've tried it!), 
> select all the 
> nodes whose name is equal to whatever the value of $some-variable is.
> -------------------------------------------------------------
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.