Michael Terry wrote:
I think I misunderstood what becomes the context node. Take the first
one I mentioned:
id('bodyContent')/h2[1]/following-sibling::*[position()<count(following::p[1]/preceding-sibling::*)
- count(preceding-sibling::*)]
I thought that while the position() filter was running, 'h2[1]' would
be the context node. Instead, it seems the result of
'following-sibling::*' is the context node? What, does it change the
context node to each item in that set as it applies the filter? I
don't suppose there's a way to refer to the previous context node in a
relative way, is there?
In XSLT 2.0 there are a couple of provisions that make it a bit easier
to create an XPath. But in 1.0, it is just about what you say: the
context node at any given point is the one that is selected. How would
you know whether it needs the position() of first element, the second,
the third? You can use, however, a predicate, which translates freely
like "having" in SQL. In this case, the contextnode is the one that the
predicate is making a selection about.
following has context node * for position()
a/b/c/*[position() = 2]
following has context node c for position()
a/b/c[position() = 2]/*
following has context node a for position(), but beware, it is in the
third predicate, so it counts only the subset selected by the earlier
predicates.
a[count(b/c/*) = '12'][b[(_at_)x = 'rr']][position() = 2]
HTH,
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--