-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtypeMap.xsl
134 lines (129 loc) · 4.74 KB
/
typeMap.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
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
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="citeprocRemap">
<xsl:param name="cslUsage"/>
<xsl:param name="descKey"/>
<a href="#cslVar-{$descKey}"><xsl:value-of select="$cslUsage"/></a>
</xsl:template>
<xsl:template name="cslVarForZField">
<xsl:param name="name"/>
<ul class="inline-list">
<xsl:for-each select="$name">
<li>
<xsl:choose>
<xsl:when test="/map/citeprocJStoCSLmap/remap[@citeprocField=current()/@cslField]">
<xsl:call-template name="citeprocRemap">
<xsl:with-param name="cslUsage" select="/map/citeprocJStoCSLmap/remap[@citeprocField=current()/@cslField]/@cslUsage"/>
<xsl:with-param name="descKey" select="/map/citeprocJStoCSLmap/remap[@citeprocField=current()/@cslField]/@descKey"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<a href="#cslVar-{@cslField}"><xsl:value-of select="@cslField"/></a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="typeMap.css" />
</head>
<body>
<h2><a name="toc">Zotero Item Types</a></h2>
<h4>Generated with Zotero <xsl:value-of select="map/zoteroVersion/@value"/> on <xsl:value-of select="map/date/@value"/></h4>
<table>
<thead>
<tr><th>Zotero type</th><th>CSL type</th></tr>
</thead>
<tbody>
<xsl:for-each select="map/zTypes/typeMap">
<xsl:sort select="@zType"/>
<tr>
<td><a href="#map-{@zType}"><xsl:value-of select="@zType"/></a></td>
<td><xsl:value-of select="@cslType"/></td>
</tr>
</xsl:for-each>
<xsl:for-each select="map/cslVars/itemTypes/type">
<xsl:sort select="@name"/>
<xsl:if test="not(/map/zTypes/typeMap[@cslType=current()/@name])">
<tr>
<td></td>
<td><xsl:value-of select="@name"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</tbody>
</table>
<hr />
<h3>CSL variable descriptions</h3>
<table>
<thead><tr><th>CSL variable</th><th>Description</th></tr></thead>
<tbody>
<xsl:for-each select="map/cslVars/vars/var">
<xsl:sort select="@name"/>
<tr>
<td><a name="cslVar-{@name}"><xsl:value-of select="@name"/></a>
<xsl:if test="not(/map/cslFieldMap/map[@cslField=current()/@name] | /map/cslCreatorMap/map[@cslField=current()/@name] | /map/citeprocJStoCSLmap/remap[@descKey=current()/@name])">*</xsl:if>
</td>
<td>[<xsl:value-of select="@type"/>] <xsl:value-of select="@description"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
* CSL variable has no corresponding Zotero field
<xsl:for-each select="map/zTypes/typeMap">
<xsl:sort select="@zType"/>
<hr />
(<a href="#toc">top</a>)
<h3><a name="map-{@zType}"><xsl:value-of select="@zType"/> → <xsl:value-of select="@cslType"/></a></h3>
<table>
<thead>
<tr><th>UI Label</th><th>Zotero field</th><th>CSL field</th></tr>
</thead>
<tbody>
<xsl:for-each select="field">
<xsl:sort select="@value"/>
<tr>
<td>
<xsl:value-of select="@label"/>
</td>
<td>
<xsl:value-of select="@value"/>
<xsl:if test="@baseField"> (<xsl:value-of select="@baseField"/>)</xsl:if>
</td>
<td>
<xsl:call-template name="cslVarForZField">
<xsl:with-param name="name" select="/map/cslFieldMap/map[@zField=current()/@baseField] | /map/cslFieldMap/map[not(current()/@baseField) and @zField=current()/@value]"/>
</xsl:call-template>
</td>
</tr>
<xsl:if test="@value = 'creator'">
<xsl:for-each select="creatorType">
<xsl:sort select="@value"/>
<tr>
<td class="zSubType">
<xsl:value-of select="@label"/>
</td>
<td class="zSubType">
<xsl:value-of select="@value"/>
<xsl:if test="@baseField"> (<xsl:value-of select="@baseField"/>)</xsl:if>
</td>
<td class="zSubType">
<xsl:call-template name="cslVarForZField">
<xsl:with-param name="name" select="/map/cslCreatorMap/map[@zField=current()/@baseField] | /map/cslCreatorMap/map[not(current()/@baseField) and @zField=current()/@value]"/>
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>