-
Notifications
You must be signed in to change notification settings - Fork 7
/
nordic2020-schematron-to-html.xsl
90 lines (90 loc) · 3.77 KB
/
nordic2020-schematron-to-html.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sch="http://purl.oclc.org/dsdl/schematron" exclude-result-prefixes="#all" version="2.0">
<xsl:template match="/">
<html lang="en" xml:lang="en">
<head>
<title>Schematron rules for Nordic EPUB 2020-1</title>
<style>
body{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
max-width: 95%;
margin: auto;
}
h1{
text-align: center;
font-size: 1.5rem;
margin-top: 1rem;
margin-bottom: 2rem;
}
table,
th,
td{
border: 0.1rem solid #ddd;
border-collapse: collapse;
padding: 0.5rem;
}
table{
margin-bottom: 2rem
}
tr:nth-child(even){
background-color: #f2f2f2;
}
tbody tr:hover{
background-color: #ddd;
}
thead{
background-color: #1D393C;
color: white;
}
td:first-child{
white-space: nowrap;
}
footer{
margin-top: 1rem;
margin-bottom: 1rem;
text-align: center;
font-size: 0.8rem;
}</style>
</head>
<body>
<h1>Schematron rules for Nordic EPUB 2020-1</h1>
<table>
<thead>
<tr>
<th>Rule</th>
<th>Global description</th>
<th>Detailed description</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="//sch:pattern">
<tr>
<td>
<xsl:value-of select="substring(sch:title, 6)"/>
</td>
<td>
<xsl:value-of select="sch:p"/>
</td>
<td>
<xsl:for-each select="sch:rule/sch:report | sch:rule/sch:assert">
<xsl:choose>
<xsl:when test="not(following-sibling::sch:report or following-sibling::sch:assert)">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
<br/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<br/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>