untitled

(ff) #1

11.1 Transformation as Digestion 263


<?xml version="1.0"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">





















Transform 11.1 An XML transformation program that changes the name of protein
elements from “Protein” to “P”, and similarly changes “Substrate” to “S”. All other
elements are unchanged.


ing elements have been “digested.” Digestion and the subsequent expos-
ing of child elements to attack by other templates is accomplished by using
thexsl:apply-templatescommand. One can be selective about exactly
which of the child elements will be exposed by using aselectcriterion.
Figure 11.3 illustrates how the hierarchical structure relates to the templates.
Note that the context changes as a result of the “digestion” of an element.
The last template in transform 11.1 is saying: “by default, copy all elements
and attributes, and then apply appropriate templates to the attributes and
child elements that are in each element.” This template is a handy one to
include in any XSLT program that is modifying some of the features of an
XML document, but which is leaving most of the features unchanged.

Free download pdf