|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xslt 2. index-of, nodes
Dave,
> Hence I need to find out, roughly
> whether the context-item() is 1,2,3,4 etc, in
> the sequence of all loc elements with identical hl, side and pos
> attributes.
I think that using the same method as you'd use in XSLT 1.0 would
work:
count(preceding::loc[@hl = $context/@hl and
@side = $context/@side and
@pos = $context/@pos]) + 1
> variable name='set'
> select='//loc[@hl=$context/@hl and @side=$context/@side and
> @pos=$context/@pos]'
>
> What's not working as I expect is index-of($set,context-item())
> since (I guess) it uses typed value, not the node itself?
> (Always returns 1)
That's right. The arguments to index-of() are atomised to atomic
values, so you're getting the index of the <loc> element with the same
typed value as the <loc> element you're looking at.
Of course there might be other, better, methods depending on how
you're processing the <loc> elements. For example, perhaps you could
use XSLT 2.0's grouping mechanism to process all the <loc> elements in
the group at once, and then just use position().
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








