forked from citation-style-language/utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-locales-1.0-to-1.0.1.xsl
128 lines (118 loc) · 5.44 KB
/
update-locales-1.0-to-1.0.1.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
<xsl:stylesheet xmlns:cs="http://purl.org/net/xbiblio/csl" xmlns="http://purl.org/net/xbiblio/csl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="cs">
<xsl:output indent="yes" method="xml" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/cs:locale">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="xml:lang">
<xsl:value-of select="document('locales-nl-NL.xml')/cs:locale/@xml:lang"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="cs:info">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="cs:date[@form='numeric']">
<xsl:copy-of select="document('locales-nl-NL.xml')/cs:locale/cs:date[@form='numeric']"/>
</xsl:template>
<xsl:template match="cs:date[@form='text']">
<xsl:copy-of select="document('locales-nl-NL.xml')/cs:locale/cs:date[@form='text']"/>
</xsl:template>
<xsl:template match="cs:style-options">
<xsl:copy-of select="document('locales-nl-NL.xml')/cs:locale/cs:style-options"/>
</xsl:template>
<xsl:template match="cs:terms">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="cs:term">
<xsl:variable name="name" select="@name" />
<xsl:variable name="form" select="@form" />
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:choose>
<xsl:when test="cs:single and cs:multiple">
<xsl:choose>
<xsl:when test="@form">
<xsl:choose>
<xsl:when test="document('locales-nl-NL.xml')//cs:term[@name=$name and @form=$form]/cs:single and document('locales-nl-NL.xml')//cs:term[@name=$name and @form=$form]/cs:multiple">
<xsl:element name="single">
<xsl:value-of select="document('locales-nl-NL.xml')//cs:term[@name=$name and @form=$form]/cs:single"/>
</xsl:element>
<xsl:element name="multiple">
<xsl:value-of select="document('locales-nl-NL.xml')//cs:term[@name=$name and @form=$form]/cs:multiple"/>
</xsl:element>
</xsl:when>
<xsl:when test="//cs:term[@name=$name and @form=$form]/cs:single and //cs:term[@name=$name and @form=$form]/cs:multiple">
<xsl:element name="single">
<xsl:value-of select="//cs:term[@name=$name and @form=$form]/cs:single"/>
</xsl:element>
<xsl:element name="multiple">
<xsl:value-of select="//cs:term[@name=$name and @form=$form]/cs:multiple"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="document('locales-nl-NL.xml')//cs:term[@name=$name and not(@form)]/cs:single and document('locales-nl-NL.xml')//cs:term[@name=$name and not(@form)]/cs:multiple">
<xsl:element name="single">
<xsl:value-of select="document('locales-nl-NL.xml')//cs:term[@name=$name and not(@form)]/cs:single"/>
</xsl:element>
<xsl:element name="multiple">
<xsl:value-of select="document('locales-nl-NL.xml')//cs:term[@name=$name and not(@form)]/cs:multiple"/>
</xsl:element>
</xsl:when>
<xsl:when test="//cs:term[@name=$name and not(@form)]/cs:single and //cs:term[@name=$name and not(@form)]/cs:multiple">
<xsl:element name="single">
<xsl:value-of select="//cs:term[@name=$name and not(@form)]/cs:single"/>
</xsl:element>
<xsl:element name="multiple">
<xsl:value-of select="//cs:term[@name=$name and not(@form)]/cs:multiple"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@form">
<xsl:choose>
<xsl:when test="document('locales-nl-NL.xml')//cs:term[@name=$name and @form=$form]">
<xsl:value-of select="document('locales-nl-NL.xml')//cs:term[@name=$name and @form=$form]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//cs:term[@name=$name and @form=$form]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="document('locales-nl-NL.xml')//cs:term[@name=$name and not(@form)]">
<xsl:value-of select="document('locales-nl-NL.xml')//cs:term[@name=$name and not(@form)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//cs:term[@name=$name and not(@form)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>
<xsl:template match="comment()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>