-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdescribe_vcard.xslt
149 lines (140 loc) · 4.25 KB
/
describe_vcard.xslt
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:v="http://www.imsglobal.org/xsd/imsvdex_v1p0">
<xsl:output method="html"/>
<xsl:param name="lang"/>
<xsl:param name="fieldnum"/>
<xsl:param name="voc_source"/>
<xsl:template match="v:vdex">
<html>
<head>
<title>
<xsl:call-template name="title" />
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>
<xsl:call-template name="title" />
</h1>
<h2>
<xsl:apply-templates select="v:vocabName"/>
</h2>
<xsl:if test="$voc_source != ''">
<h2>Source: <code><xsl:value-of select="$voc_source"/></code></h2>
</xsl:if>
<dl>
<xsl:apply-templates select="v:term"/>
</dl>
<br />
<hr />
<br />
<style type="text/css">
td {padding-right:1em;}
</style>
<xsl:choose>
<xsl:when test="$lang='fr'">
<table>
<th>
<td colspan="2">Légende</td>
</th>
<tr>
<td>
<code>identifiant</code>
</td>
<td style="font-size:smaller;">à employer dans le xml</td>
</tr>
<tr>
<td>
<em>terme</em>
</td>
<td style="font-size:smaller;">si distinct de l'identifiant</td>
</tr>
<tr>
<td>définition</td>
<td style="font-size:smaller;">corps normal, en retrait</td>
</tr>
</table>
</xsl:when>
<xsl:when test="$lang='en'">
<table>
<th>
<td colspan="2">Legend</td>
</th>
<tr>
<td>
<code>identifier</code>
</td>
<td style="font-size:smaller;">to use in the xml</td>
</tr>
<tr>
<td>
<em>term</em>
</td>
<td style="font-size:smaller;">if distinct from the identifier</td>
</tr>
<tr>
<td>définition</td>
<td style="font-size:smaller;">normal typeface, indented</td>
</tr>
</table>
</xsl:when>
</xsl:choose>
</body>
</html>
</xsl:template>
<xsl:template name="title">
<xsl:choose>
<xsl:when test="$lang='fr'">
<xsl:text>Vocabulaire pour le champ LOM </xsl:text>
</xsl:when>
<xsl:when test="$lang='en'">
<xsl:text>Vocabulary for the LOM field </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$fieldnum"/>
</xsl:template>
<xsl:template match="v:term">
<xsl:variable name="caption">
<xsl:apply-templates select="v:caption"/>
</xsl:variable>
<dt>
<xsl:choose>
<xsl:when test="v:description and $caption != '' and translate($caption,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') != v:termIdentifier/text()">
<em>
<xsl:value-of select="$caption" />
</em>
<xsl:text> (</xsl:text>
<code><xsl:value-of select="v:termIdentifier/text()"/></code>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:otherwise>
<code><xsl:value-of select="v:termIdentifier/text()"/></code>
</xsl:otherwise>
</xsl:choose>
</dt>
<dd>
<xsl:choose>
<xsl:when test="not(v:description)">
<xsl:value-of select="$caption" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="v:description"/>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:template>
<xsl:template match="v:langstring">
<xsl:if test="not(@language) or substring(@language,1,2)=$lang">
<xsl:value-of select="text()"/>
</xsl:if>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>