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

Re: Using XSL parameters to construct variables to con

Subject: Re: Using XSL parameters to construct variables to construct expressions
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 21 Mar 2003 06:53:22 +0100
construct variable
> XML snippet:
> <process>
>      <number>1</number>
>      <name>evaluate</name>
>      <descrip>[Description.]</descrip>
> </process>
>
> XSL snippet:
> <!-- default value of params is empty string; if user chooses a
processArea option, I'll send the parameter to the stylesheet and set this
value -->
> <xsl:param name="processArea" /><!-- if sent, value will be 1, 2, 3 or
4 -->
> . . .
> . . .
> <xsl:variable name="selectStatement">/process-report/process
>      <xsl:if test="$processArea != ''">[starts-with(number,<xsl:value-of
select="$processArea"/>)]</xsl:if>
> </xsl:variable>
> . . .
> . . .
> <xsl:apply-templates select="$selectStatement"/>
>

This is a FAQ:  Standard XSLT 1.0 and 2.0 do not support dynamic evaluation
of string representation of an XPath expression.

And in this case dynamic evaluation is not necessary -- use:

 <xsl:apply-templates select="process[starts-with(number, $processArea)]"/>



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL





 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.