XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Structure controls processing / Free-flow processing
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)
The new stylesheet is almost finished. The final change simplifies the template rule for the document node. Here too, the select attribute is omitted from xsl:apply-templates:
<!-- Template-Regel für den Dokumentknoten: -->
<xsl:template match="/">
...
<h1>Adressenliste</h1>
<xsl:apply-templates/>
...
</xsl:template>
Code example: kap01/1.17.2/addressen.xsl (excerpt).
This figure shows the result in the browser:
Figure: The newly transformed address list.
It really works, without problems. This may seem surprising considering the effort previously needed to prepare the correct input sequence for template rules. No such measures were taken here, yet the transformation works as intended.
The document-node template rule constructs a child-node sequence containing exactly one item: the document’s root element <adressen>. No template rule exists for it, yet its child nodes <adresse> are processed next. A sequence of <adresse> element nodes must therefore come from somewhere. But where is it constructed, given that no explicit instruction requests it?
Copyright © Galileo Press, Bonn 2008
You may print the online version for your private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn