Re: [xsl] How to get page range within a group

Subject: Re: [xsl] How to get page range within a group
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 12 Sep 2008 15:13:48 +0100
> This isn't working for you since the expression //doc//pb[position()=1] does
> not return what you think it does.
>
> It may appear it should return the first 'pb' element appearing inside each
> 'doc' element in the document, but this isn't so. The semantics of "//" is
> not (as it is commonly glossed) "all the nodes (or elements) all the way
> down the tree". It is an abbreviation for "/descendant-or-self::node()/",
> which in itself is not a complete XPath expression, but must be completed by
> adding an axis and node test. In particular, when you say "//pb" you are
> implicitly adding the child:: axis (as always when no axis is given
> explicitly) along with the "pb" node test. That is, "//pb" is short for
> "/descendant-or-self::node()/child::pb".
>
> This is crucial since it means that //pb[1] does not mean "the first 'pb'
> descendant" but "the first pb child of any descendant".

I might not have understood properly, but:

//doc//pb[1]

will return the first <pb> descendant of all <doc> elements

it sounds like you're suggesting it won't include <pb> children of <doc> ?



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread