This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Variables in XPath expressions


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]