XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Stylesheets with multiple templates / Continuing the activation chain
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)
First, of course, the rule for <adresse> must be modified accordingly so that the subordinate template rules are also invoked as intended.
This is essential: if a template rule is to continue a processing chain, xsl:apply-templates must ensure that further templates can be activated from within it.
To do this, replace xsl:value-of with the familiar xsl:apply-templates:
<!-- Template-Regel für <adresse>: -->
<xsl:template select="adresse">
<!-- Sequenz der Kindelemente von Adresse: -->
<p><xsl:apply-templates select="*"/></p>
</xsl:template>
Code example: kap01/1.15.5/adressen.xsl (excerpt).
The value of the select attribute is the wildcard * and a sequence of all child elements of the context node is formed.
Caution! Child nodes of other kinds, such as text nodes, are not included in the sequence. This is irrelevant here because the structure of the source document is fixed and only elements are known to occur at this point. Otherwise, the select attribute with this value acts, intentionally or otherwise, as a filter excluding nodes other than elements.
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