Raman Gupta wrote:
<!-- process nodes after group -->
<xsl:apply-templates select="*[preceding-sibling::g2[last()]]"/>
The way I read this is: apply templates to all the nodes that have the
LAST g2 as a preceding sibling, which should apply templates to all
nodes n3 to n4.
Close, but not close enough. This would be of interest to Mathieu
Malaterre as well, if he is listening You are expressing:
*
Take all nodes
[...]
having
preceding-sibling::g2
a sibling preceding myself and with the name 'g2'
[...]
having
last()
a position that is the last in the list (the list being "siblings
preceding myself and with the name 'g2' ")
This means in even better English: select all nodes that has a preceding
sibling with the name 'g2'. In your statement, last() does not do
anything and is redundant.
This is just the same as when you would make the following xpath:
some/node/*[childnode[last()]]
Here, too, is last() meaning just the same as [1], or leaving out the
predicate completely.
BTW, having to select the last 'g2' in your English sentence means the
g2 on the preceding/following sibling access, not being on the following
sibling axis (i.e., not being in front of it). Expressed as:
*[not(following-sibling::g2)]
meaning: not having any following sibling of type g2. Which is basically
what you said, I think.
HTH,
Cheers,
-- 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>
--~--