Debian Codegraph @

util/buildscripts/cldr/currency.xsl

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="saxon" version="2.0">
3 <xsl:import href="util.xsl"/>
4 <xsl:output method="text" indent="yes" saxon:byte-order-mark="yes"/>
5 <!-- list the data elements whose spaces should be preserved
6 it seems listing only the parent node doesn't work -->
7 <xsl:preserve-space elements="displayName symbol"/>
8 <xsl:strip-space elements="*"/>
9
10 <!-- currencyList is an external string property like "AUD|BEF|CAD|CHF|CNY|DEM|...|USD",
11 if it is provided, only those currencies in this list will be extracted,
12 otherwise all the currencies will be extracted by default-->
13 <xsl:param name="currencyList"></xsl:param>
14
15 <xsl:template match="/">
16 <xsl:apply-templates/>
17 </xsl:template>
18
19 <!-- process ldml, numbers and currencies -->
20 <xsl:template name="top" match="/ldml">
21 <xsl:choose>
22 <xsl:when test="count(./alias)>0">
23 <!-- Handle Alias -->
24 <xsl:for-each select="./alias">
25 <xsl:call-template name="alias_template">
26 <xsl:with-param name="templateToCall">top</xsl:with-param>
27 <xsl:with-param name="source" select="@source"></xsl:with-param>
28 <xsl:with-param name="xpath" select="@path"></xsl:with-param>
29 </xsl:call-template>
30 </xsl:for-each>
31 </xsl:when>
32 <xsl:otherwise>
33 <xsl:choose>
34 <xsl:when test="name()='currencies'">
35 <xsl:result-document href="currency.js" encoding="UTF-8">// generated from ldml/main/*.xml, xpath: ldml/numbers/currencies
36 ({<xsl:choose><xsl:when test="string-length(string($currencyList))>0 and string($currencyList)!='${currencies}'">
37 <!--if outer param $currencyList is not initiated, it will be '${currencies}' by default,please see ${util}/buildscripts/cldr/build.xml -->
38 <xsl:for-each select="currency">
39 <xsl:if test="contains($currencyList,@type)">
40 <xsl:call-template name="currency"></xsl:call-template>
41 </xsl:if>
42 </xsl:for-each>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:for-each select="currency">
46 <xsl:call-template name="currency"></xsl:call-template>
47 </xsl:for-each>
48 </xsl:otherwise>
49 </xsl:choose>
50 })
51 </xsl:result-document>
52 </xsl:when>
53 <xsl:otherwise>
54 <xsl:if test="name()='ldml'">
55 <!-- ldml -->
56 <xsl:for-each select="numbers">
57 <xsl:call-template name="top"></xsl:call-template>
58 </xsl:for-each>
59 </xsl:if>
60 <xsl:if test="name()='numbers'">
61 <!-- numbers -->
62 <xsl:for-each select="currencies">
63 <xsl:call-template name="top"></xsl:call-template>
64 </xsl:for-each>
65 </xsl:if>
66 </xsl:otherwise>
67 </xsl:choose>
68 </xsl:otherwise>
69 </xsl:choose>
70 </xsl:template>
71
72 <!-- currency-->
73 <xsl:template name="currency" match="currency">
74 <xsl:param name="width" select="@type"></xsl:param>
75 <xsl:choose>
76 <xsl:when test="count(./alias)>0">
77 <!-- Handle Alias -->
78 <xsl:for-each select="./alias">
79 <xsl:call-template name="alias_template">
80 <xsl:with-param name="templateToCall">currency</xsl:with-param>
81 <xsl:with-param name="source" select="@source"></xsl:with-param>
82 <xsl:with-param name="xpath" select="@path"></xsl:with-param>
83 </xsl:call-template>
84 </xsl:for-each>
85 </xsl:when>
86 <xsl:otherwise>
87 <!-- CLDR 1.6+: skip entries in the form of displayName count="" until we implement plurals -->
88 <!-- skip narrow forms as well -->
89 <xsl:for-each select="*[not(@count) and (not(@draft) or (@draft!='provisional' and @draft!='unconfirmed')) and not(@alt)]">
90 <xsl:call-template name="insert_comma"/>
91 <xsl:text>
92 </xsl:text>
93 <xsl:value-of select="$width"></xsl:value-of>
94 <xsl:text>_</xsl:text>
95 <xsl:value-of select="name()"></xsl:value-of>
96 <xsl:text>:"</xsl:text>
97 <xsl:value-of select="replace(.,'&quot;', '\\&quot;')"></xsl:value-of>
98 <xsl:text>"</xsl:text>
99 </xsl:for-each>
100 </xsl:otherwise>
101 </xsl:choose>
102 </xsl:template>
103
104 <!-- too bad that can only use standard xsl:call-template(name can not be variable)
105 error occurs if use <saxson:call-templates($templateToCall) /> -->
106 <xsl:template name="invoke_template_by_name">
107 <xsl:param name="templateName"></xsl:param>
108 <xsl:param name="name"></xsl:param>
109 <xsl:param name="width"></xsl:param>
110 <xsl:param name="ctx"></xsl:param>
111 <xsl:param name="fromLocaleAlias"></xsl:param>
112 <xsl:if test="$templateName='top'">
113 <xsl:call-template name="top"></xsl:call-template>
114 </xsl:if>
115 <xsl:if test="$templateName='currency'">
116 <xsl:call-template name="currency"></xsl:call-template>
117 </xsl:if>
118 </xsl:template>
119 </xsl:stylesheet>