XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / The XML document as a tree / Text nodes

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

A text node contains only Character data. It therefore has no hierarchical internal structure. A contiguous stretch of character data in a document is represented by exactly one text node. Two text nodes cannot be directly adjacent in a tree, since they would be combined. (Note that processing can also create string literals of type xs:string. These are atomic values rather than text nodes. They can occur consecutively in a sequence and are combined only when the result is serialized.)

Also, CDATA sections, as found in XML documents, are always represented by text nodes. They have no separate node type in the document tree. Once a document has passed through the XML parser, it is no longer possible to determine whether a text node originally came from a CDATA section.

Similarly, text entities are expanded during parsing. Their replacement text takes the place of the original entity reference. Again, it is no longer possible afterward to tell whether such references existed in the document.

   

back to top