XSLT/XPath - (Data|Document) Model

> Markup Language (ML) > Xml - XSL Transformations (XSLT)

1 - About

Each element has an associated string-value, which is formed by concatenating all the text segments that lie under the element.

Like the Document Object Model (DOM), the XSLT/XPath data model consists of a tree containing a variety of nodes. Under any given element node, there are:

  • text nodes,
  • attribute nodes,
  • element nodes,
  • comment nodes,
  • and processing instruction nodes.

In this abstract model, syntactic distinctions disappear, and you are left with a normalized view of the data.

In a text node, for example, it makes no difference whether the text was defined in a CDATA section or whether it included entity references.

The text node will consist of normalized data, as it exists after all parsing is complete.

So the text will contain a < character, whether or not an entity reference such as < or a CDATA section was used to include it. (Similarly, the text will contain an & character, whether it was delivered using & or it was in a CDATA section).

The XPath specification defines an abstract document model that defines seven kinds of nodes:

  • Root
  • Element
  • Text
  • Attribute
  • Comment
  • Processing instruction
  • Namespace

The root element of the XML data is modeled by an element node. The XPath root node contains the document's root element as well as other information relating to the document.

Advertising

3 - Documentation / Reference

markup/xslt/data_model.txt ยท Last modified: 2019/02/09 11:41 by gerardnico