[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Diagram of XPath axes

Subject: Re: [xsl] Diagram of XPath axes
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Thu, 24 May 2012 19:02:16 +0200

Just a side note: If you want to select the preceding elements *including the ancestors*, use the XPath 2 << operator [1], which selects the nodes that precede the current in document order [2].

In XSLT: select="*[. &lt;&lt; current()]"


[1] http://www.w3.org/TR/xpath-functions/#func-node-before
[2] http://www.w3.org/TR/xpath-datamodel/#document-order

On 2012-05-24 15:09, Ihe Onwuka wrote:
On Thu, May 24, 2012 at 1:58 PM,<mlcook@xxxxxxxxxx> wrote:

One additional question, please:

Preceding nodes do not include ancestors, which I've thought is odd. It includes siblings, but not parent or grand-parent, etc.

When looking at an XML file in an editor, ancestors surely seem to be preceding where I am in the document.

Ancestors start before where you are but they have not ended, therefore they don't precede you.

-- Gerrit Imsieke Geschdftsf|hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vvckler

Current Thread