blob: 6202f0dc7d0ca062a3727953112523e1e8eec987 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?xml version="1.0"?>
<!-- baseball game stats -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8"/>
<xsl:template match="game">
<tr>
<td>Inning</td>
<xsl:for-each select="innings/inning">
<td>
<xsl:value-of select="num"/>
</td>
</xsl:for-each>
<td>final</td>
</tr>
<tr>
<td><b><xsl:value-of select="home"/></b></td>
<xsl:for-each select="innings/inning">
<td>
<xsl:value-of select="home/runs"/>
</td>
</xsl:for-each>
<td>
<xsl:value-of select="sum(innings/inning/home/runs)"/>
</td>
</tr>
<tr>
<td><b><xsl:value-of select="visitors"/></b></td>
<xsl:for-each select="innings/inning">
<td>
<xsl:value-of select="visitors/runs"/>
</td>
</xsl:for-each>
<td>
<xsl:value-of select="sum(innings/inning/visitors/runs)"/>
</td>
</tr>
</xsl:template>
<xsl:template match="/">
<html>
<table border="1">
<xsl:apply-templates select="games/game"/>
</table>
</html>
</xsl:template>
</xsl:stylesheet>
|