|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Context inside brackets
On 21/05/2015 11:46, Jorge . chocolate.camera@xxxxxxxxx wrote:
<xsl:variable name="POSITION" select="position()" as="xs:integer"/> <xsl:sequence select="$FOO[$POSITION]"/> Interestingly my immediate reaction, "$FOO[current()/position()]" isn't right. current() does indeed give the XSLT context item, but as a sequence of item(), i.e. a singleton sequence, so it has a position of 1 within the scope of the /. Thus the top-level XPath expression position() = current()/position(), within some XSLT iteration is not (usually) true. Michael Kay states "in practice it's very rare to write an expression on the right-hand side of <</>> that depends upon the context position or size" on p 603 of the 4th Edition of his XSLT2.0 Programmer's Reference. In years of working with XSLT I hadn't looked at this issue in any detail. When something didn't work as anticipate either I used the XSLT variable binding or in XSLT 3 use a local let, as Martin Honnen suggested. ;-) -- *John Lumley* MA PhD CEng FIEE john@xxxxxxxxxxxx <mailto:john@xxxxxxxxxxxx> on behalf of Saxonica Ltd
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








