-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgc2html.xsl
57 lines (51 loc) · 1.83 KB
/
gc2html.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/"
exclude-result-prefixes="xs math"
expand-text="yes"
version="3.0">
<!-- Regular expression for selecting specific columns from a code list -->
<!-- If you want to show only specific columns use their IDs as a parameter, separated by | -->
<!-- e.g. name|code|description -->
<xsl:param name="columns">.*</xsl:param>
<xsl:template match="/">
<xsl:param name="cols" select="/gc:CodeList/ColumnSet/Column[matches(@Id, $columns)]"/>
<html>
<head>
<title>{/gc:CodeList/Identification/ShortName}</title>
</head>
<body>
<h1>{/gc:CodeList/Identification/ShortName}</h1>
<xsl:for-each select="/gc:CodeList/Identification/LongName">
<p>{.}</p>
</xsl:for-each>
<table border="1">
<thead>
<tr>
<xsl:for-each select="$cols">
<th title="{LongName}">
{ShortName}
</th>
</xsl:for-each>
</tr>
</thead>
<tbody>
<xsl:for-each select="/gc:CodeList/SimpleCodeList/Row">
<xsl:variable name="row" select="."/>
<tr>
<xsl:for-each select="$cols">
<xsl:variable name="colId" select="@Id"/>
<td>
<xsl:value-of select="$row/Value[@ColumnRef=$colId]/SimpleValue"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>