
Extensible Stylesheet Language (XSL) • 303
<RAINFALL>
<YEAR>2004</YEAR>
<RAINFALL>98</RAINFALL>
</RAINFALL>
<RAINFALL>
<YEAR>2005</YEAR>
<RAINFALL>500</RAINFALL>
</RAINFALL>
<RAINFALL>
<YEAR>2006</YEAR>
<RAINFALL>320</RAINFALL>
</RAINFALL>
</RAINFALL_LIST>
Solution
Note that we have the element RAINFALL at two levels, once
immediately after the root, and once more inside RAINFALL
itself. Hence, our expression would also include it two times,
as shown in the XSLT below.
<?xml version=”1.0”?>
<xsl:stylesheet version=”1.0” xmlns:xsl=”http://www.
w3.org/1999/XSL/Transform”>
<xsl:template match=”/”>
<total>
Total rainfall since 2001 = <xsl:variable ...