XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / The XML document as a tree / Why tree structures?

(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)

Viewing a document as a tree structure may seem abstract, but it greatly improves understanding of XSLT and XPath

Document structure as a directed graph

Figure: Document structure as a directed graph.

An XML document is represented by a tree in the mathematical sense. It is drawn pointing downwards, with a single starting point at the top called the root or document node. Do not confuse this with the document’s root element. More precisely, this kind of tree is a directed graph (Note: More precisely, it is a directed acyclic graph (DAG) in graph theory. Being acyclic means that no branch loops back on itself, preventing infinite loops during traversal.) It consists of nodes (nodes) and connections (edges). Nodes at the ends of branches are called leaves (leaf-nodes).

   

back to top