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

RE: Parameters in XPath

Subject: RE: Parameters in XPath
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 7 Jan 2003 18:43:22 -0000
xpath parameters
> What I'm trying to accomplish with the Filter
> parameter is to dynamically pass into the stylesheet a
> XPath expression to be evaluated.
> For example:
> 
> <xsl:param name="Filter" select="@rebate>9.99 and 
> @shippingMethod='Ground' and @cost<199.99"/>
> 
> <xsl:apply-templates
> select="/Cat[@CatId=$Cat]/Prod[$Filter]"/>
> 

And I think several people explained (a) that you can't do this, except
with the xx:evaluate() extension that several processors provide, and
(b) that if you do use these extensions, the select attribute must be a
string containing the expression, not the expression itself: so you need
to write:

<xsl:variable name="defaultFilter">@rebate &gt; 9.99 and 
@shippingMethod='Ground' and @cost &lt; 199.99</xsl:variable>

<xsl:param name="Filter" select="string($defaultFilter)"/>

If you write it your way, $Filter will be the value of the expression,
not the expression itself.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 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.