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

Re: Context inside brackets

Subject: Re: Context inside brackets
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 May 2015 12:04:11 -0000
Re:  Context inside brackets
Jorge . chocolate.camera@xxxxxxxxx wrote:
Having a sequence stored in a variable, how do I reference the item in
that sequence whose position is the same as the position of the
current node with respect to its context, with XSLT 2?

This does return what I expect:

<xsl:variable name="POSITION" select="position()" as="xs:integer"/>
<xsl:sequence select="$FOO[$POSITION]"/>

but I somehow feel that there must be a way to call the `position()`
of the current node from inside those brackets without the meaning of
the function actually becoming the position of the variable itself
instead of the current node's. Is there?

I don't think so, I think you need the variable.


I am using Saxon-HE 9.2.1.2J on OS X 10.10.3 (14D136).

Using the latest Saxon 9.6 and XSLT 3.0 you could delegate the variable binding to XPath with e.g.


<xsl:sequence select="let $pos := position() return $FOO[$pos]"/>

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.