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

Variables in XPath expressions

Subject: Variables in XPath expressions
From: Emmanuel Pietriga <emmanuel.pietriga@xxxxxxxxxxxxxx>
Date: Wed, 29 Mar 2000 08:17:10 +0200
variables in xpath
Hi.

I just want to be sure of something.

I want to select an element wrt its position: el1/*[position()=3], but
the position is extracted from the source document.
So what I thought I would do was put the value of the wanted position in
a xsl:variable
<xsl:variable name="i">
  <xsl:value-of select="el1/aPosition"/>
</xsl:variable>

and then use the value of this variable later in my xpath selector, like
this:
<xsl:value-of select="el1/*[position()={$i}]"/>

But the engine tells me that $ is not allowed.   (I'm using XP+XT)

I've figured out another way of doing what I want just using number(),
but I'd like to be sure that variables aren't allowed in an XPath
expression (I think I read somewhere that variables could be used in
xpath expressions in some cases, depending on the xsl instruction used)

Thanks.

Emmanuel.



 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.