[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Obtaining a specific context position()
Subject: Re: Obtaining a specific context position()
From: "Mark Wilson" <mark@xxxxxxxxxxxx>
Date: Sun, 8 Nov 2009 14:59:03 -0800
|
Hi David,
That worked just fine.
I misunderstood the nature of XSLT variables and was under the impression
that once initialized their value could not be changed. Clearly, I need to
re-read that section of the book.
I am actually generating a series of id's and need the value of the id to be
constant across files. My reading of gererate-id() was that the id could
change each time the file was processed. and that it was not recommended for
use in hyperlinks between different HTML files. (Michael's book on XSLT and
XPath).
Thanks,
Mark
--------------------------------------------------
From: "David Carlisle" <davidc@xxxxxxxxx>
Sent: Sunday, November 08, 2009 2:35 PM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Obtaining a specific context position()
the value returned by position() is unrelated to the position of the node
in the source tree, it is just a function of the context selected by the
current xpath (for example if you select a node with . then it has
position()=1 whevever it appears in the source)
It's not clear really what you want for the subdiv version, in your
posted sample it was the same value as in the heading, in which case you
can just save it in a variable and use it twice.
<xsl:variable name="h" select="position()"/>
<Heading>
<xsl:value-of select="$h"/> <!-- first call -->
</Heading>
<xsl:for-each-group select="current-group()"
group-by="SubDiv1">
<xsl:sort select="current-grouping-key()"
collation="{$sorting-collation}"/>
<SubDiv1>
<xsl:value-of select="$h"/> <!-- second call -->
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
|
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
RSS 2.0 |
|
Atom 0.3 |
|
|