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

Re: combining two variables to generate XPATH

Subject: Re: combining two variables to generate XPATH
From: Jeff Kenton <jkenton@xxxxxxxxxxxxx>
Date: Tue, 17 Dec 2002 15:58:21 -0500
denis nwanshi
bix xslt wrote:
Is that FAQ outdated?? I know that the following code works just fine:

<xsl:template match="proc">
 <xsl:call-template name="foo">
   <xsl:with-param name="node" select="." />
 </xsl:call-template>
</xsl:template>

<xsl:template name="foo">
 <xsl:param name="node"/>
 <xsl:for-each select="$node/branch/leaf">
   <xsl:value-of select="@id" />
 </xsl:for-each>
</xsl:template>

This is legal, as long as $node represents a nodeset (which it does here).



What is different about a path with a single variable, and a path with two variables? Why can't I specify a second variable:


<xsl:template name="foo">
 <xsl:param name="node"/>
 <xsl:param name="branch" select="'someBranch'"/>
 <xsl:for-each select="$node/$branch/leaf">
   <xsl:value-of select="@id" />
 </xsl:for-each>
</xsl:template>


This is not legal. The only place a variable reference can appear in a Path Expression is at the beginning. $node is OK here, but $branch is not.


Various previous messages suggest using evaluate() or name tests to solve your problem. They should work.



--
--------------------------
Jeff Kenton
DataPower Technology, Inc.



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.