Node types

The components of XML documents are referred to as nodes. There are 7 node types whose names are self-explanatory:

  • Root node: is not to be confused with the root element itself. The root node is rather the virtual parent node of the root element.
  • Element node
  • Attribute node
  • Text node
  • Namespace node
  • Processing instruction node
  • Comment node

Each of these nodes can be accessed with XPath and thus enables a processing with XSL.

Axes

The navigation in a XML document via XPath starts from a context node – in the following pictures referred to as SELF. The context node is always the initial point where the XSLT processor is currently situated. In this example, the names of the axes refer to family relationships – as already common for XML. In the following pictures eleven of the thirteen different axes are illustrated. Apart from the axes, which allow the navigation via the element nodes of a document tree, there are also attribute nodes and the namespace node of an element which are addressed by using the key words attribute or namespace.

The self axis contains the context node.

Self-Axis

The child axis contains all child elements of the context node.

Child-Axis

The descendant axis contains all descendants of the context node.

Descendant-Axis

The descendant-or-self axis contains all descendants and the context node itself.

Descendant-or-self-Axis

The parent axis contains all parent elements of the context node.

Parent-Axis

The ancestor axis contains all ancestors of the context node.

Ancestor-Axis

The ancestor-or-self axis contains all ancestors and the context node itself.

Ancestor-or-self-Axis

The preceding axis contains all predecessors of the context node which are no ancestors. The following axis contains all followers which are no descedants.

Preceding-Axis

The preceding-sibling axis contains all predecessors of the context node which have the same parent element, which means they are the preceding siblings. The following-sibling axis contains all followers of the context node which have the same parent element, which means they are the following siblings.

Preceding-sibling-Axis

<< back next >>

Copyright © dpunkt.verlag GmbH 2007
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "Professionelle XML-Verarbeitung mit Word" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, hallo(at)dpunkt.de