-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.xsl
59 lines (53 loc) · 1.24 KB
/
report.xsl
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
51
52
53
54
55
56
57
58
59
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Start the report -->
<xsl:template match="report">
<html>
<head>
<link rel="stylesheet" type="text/css" href="report.css"/>
<title><xsl:value-of select="title"/></title>
</head>
<body>
<xsl:value-of select="@date"/>
<h2><xsl:value-of select="title"/></h2>
<xsl:apply-templates select="page"/>
</body>
</html>
</xsl:template>
<!-- Next page -->
<xsl:template match="page">
<xsl:apply-templates select="header"/>
<xsl:apply-templates select="detail"/>
</xsl:template>
<!-- Header field names and values -->
<xsl:template match="header">
<p>
<xsl:for-each select="field">
<xsl:value-of select="@name"/>:
<b><xsl:value-of select="."/></b><br/>
</xsl:for-each>
</p>
</xsl:template>
<!-- Columnar values -->
<xsl:template match="detail">
<table width="650" border="1">
<xsl:apply-templates select="line[1]"/>
<xsl:for-each select="line">
<tr>
<xsl:for-each select="field">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
<br />
</xsl:template>
<!-- Column titles -->
<xsl:template match="line[1]">
<tr>
<xsl:for-each select="field">
<th><xsl:value-of select="@name"/></th>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>