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

Re: [xsl] Diagram of XPath axes

Subject: Re: [xsl] Diagram of XPath axes
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 24 May 2012 18:06:47 -0400

Hi Mike,

In teaching, I have used precisely the same approach as Ken, comprehensively dividing the document into the self, ancestor, descendant, following and preceding axes, all in relation to "me".

It is also worth pointing out, however, that there is some potential confusion, in that ancestors do appear "before me" in document order, while descendants appear "after me" in document order, even though (as Ken and others have noted), ancestors aren't yet done when I'm done, and descendants are all done before I'm done.

The human brain being what it is (rather messy), we then mix up the definition of document order with the specification of the different axes, and there we are. Yet the concepts are clean, if we allow them to be.

So yes, the preceding axis reaches nodes that occur *entirely* before me; and that necessarily excludes ancestors. By the same token, not all nodes before me in document order will precede me -- at least as long as I have an ancestor (which all nodes must, except document nodes).


On 5/24/2012 8:58 AM, mlcook@xxxxxxxxxx wrote:
Ken Holman's diagram is the one I had seen before that summarized lots of info concisely. I'm sure I've seen it on xsl-list or somewhere else, but don't remember where.

Otherwise, Ihe Onwuka's suggestion does have tutorial information, but I didn't see an overall diagram.

Scott Trenda pointed to a site with diagrams for individual axis access which looks helpful.

Syd Bauman also points to tutorial diagrams for individual axes with examples, and one final summarizing diagram.

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.

But perhaps "preceding" means nodes before "me" but not including anything that contains "me".

Is that a useful way to look at "preceding"?

Thanks again, Mike
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread