-
Notifications
You must be signed in to change notification settings - Fork 0
/
xml2html.xsl
66 lines (66 loc) · 3.16 KB
/
xml2html.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
60
61
62
63
64
65
66
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>SANITARY CONDITION OF WORKSHOPS AND FACTORIES</h2>
<h3>Table 1</h3>
<table border="1">
<tr>
<th>Number</th>
<th>Question</th>
<th>Yes</th>
<th>No</th>
<th>Blank</th>
<th>Total</th>
</tr>
<xsl:for-each select="surveydata/questions/question">
<xsl:if test="position() != 12">
<tr>
<xsl:choose>
<xsl:when test="position() = 13">
<td>
<xsl:value-of select="position()-1"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="position()"/></td>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="phrase"/></td>
<td><xsl:value-of select="answers/yes"/></td>
<td><xsl:value-of select="answers/no"/></td>
<td><xsl:value-of select="answers/blank"/></td>
<td><xsl:value-of select="answers/yes+answers/no+answers/blank"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<h3>Table 2</h3>
<table border="1">
<tr><th>Question</th>
<th>Sit</th>
<th>Stand</th>
<th>Blank</th>
<th>Optional</th>
<th>Total</th>
</tr>
<tr>
<xsl:for-each select="surveydata/questions/question">
<xsl:choose>
<xsl:when test="position() = 12">
<td><xsl:value-of select="phrase"/></td>
<td><xsl:value-of select="answers/sit"/></td>
<td><xsl:value-of select="answers/stand"/></td>
<td><xsl:value-of select="answers/blank"/></td>
<td><xsl:value-of select="answers/optional"/></td>
<td><xsl:value-of select="answers/sit+answers/stand+answers/blank+answers/optional"/></td>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>