| 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 |
|
| 6 |
|
| 7 |
<xsl:preserve-space elements="decimal group list pattern currencyMatch surroundingMatch insertBetween"/> |
| 8 |
<xsl:strip-space elements="*"/> |
| 9 |
|
| 10 |
<xsl:template match="/"> |
| 11 |
<xsl:apply-templates/> |
| 12 |
</xsl:template> |
| 13 |
|
| 14 |
|
| 15 |
<xsl:template name="top" match="/ldml"> |
| 16 |
<xsl:choose> |
| 17 |
<xsl:when test="count(./alias)>0"> |
| 18 |
|
| 19 |
<xsl:for-each select="./alias"> |
| 20 |
<xsl:call-template name="alias_template"> |
| 21 |
<xsl:with-param name="templateToCall">top</xsl:with-param> |
| 22 |
<xsl:with-param name="source" select="@source"></xsl:with-param> |
| 23 |
<xsl:with-param name="xpath" select="@path"></xsl:with-param> |
| 24 |
</xsl:call-template> |
| 25 |
</xsl:for-each> |
| 26 |
</xsl:when> |
| 27 |
<xsl:otherwise> |
| 28 |
|
| 29 |
<xsl:if test="name()='ldml'"> |
| 30 |
|
| 31 |
<xsl:for-each select="numbers"> |
| 32 |
<xsl:result-document href="number.js" encoding="UTF-8">// generated from ldml/main/*.xml, xpath: ldml/numbers |
| 33 |
({<xsl:call-template name="numbers"></xsl:call-template> |
| 34 |
}) |
| 35 |
</xsl:result-document> |
| 36 |
</xsl:for-each> |
| 37 |
</xsl:if> |
| 38 |
</xsl:otherwise> |
| 39 |
</xsl:choose> |
| 40 |
</xsl:template> |
| 41 |
|
| 42 |
|
| 43 |
<xsl:template name="numbers" match="numbers"> |
| 44 |
<xsl:choose> |
| 45 |
<xsl:when test="count(./alias)>0"> |
| 46 |
|
| 47 |
<xsl:for-each select="./alias"> |
| 48 |
<xsl:call-template name="alias_template"> |
| 49 |
<xsl:with-param name="templateToCall">numbers</xsl:with-param> |
| 50 |
<xsl:with-param name="source" select="@source"></xsl:with-param> |
| 51 |
<xsl:with-param name="xpath" select="@path"></xsl:with-param> |
| 52 |
</xsl:call-template> |
| 53 |
</xsl:for-each> |
| 54 |
</xsl:when> |
| 55 |
<xsl:otherwise> |
| 56 |
<xsl:apply-templates/> |
| 57 |
</xsl:otherwise> |
| 58 |
</xsl:choose> |
| 59 |
</xsl:template> |
| 60 |
|
| 61 |
|
| 62 |
<xsl:template name="symbols" match="symbols"> |
| 63 |
<xsl:choose> |
| 64 |
<xsl:when test="count(./alias)>0"> |
| 65 |
|
| 66 |
<xsl:for-each select="./alias"> |
| 67 |
<xsl:call-template name="alias_template"> |
| 68 |
<xsl:with-param name="templateToCall">symbols</xsl:with-param> |
| 69 |
<xsl:with-param name="source" select="@source"></xsl:with-param> |
| 70 |
<xsl:with-param name="xpath" select="@path"></xsl:with-param> |
| 71 |
</xsl:call-template> |
| 72 |
</xsl:for-each> |
| 73 |
</xsl:when> |
| 74 |
<xsl:otherwise> |
| 75 |
<xsl:for-each select="*[not(@draft)] | *[@draft!='provisional' and @draft!='unconfirmed']"> |
| 76 |
<xsl:call-template name="insert_comma"/> |
| 77 |
'<xsl:value-of select="name()"></xsl:value-of> |
| 78 |
<xsl:text>':"</xsl:text> |
| 79 |
<xsl:value-of select="replace(.,'"', '\\"')"></xsl:value-of> |
| 80 |
<xsl:text>"</xsl:text> |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
</xsl:for-each> |
| 86 |
</xsl:otherwise> |
| 87 |
</xsl:choose> |
| 88 |
</xsl:template> |
| 89 |
|
| 90 |
|
| 91 |
<xsl:template name="formats" match="decimalFormats | scientificFormats | percentFormats | currencyFormats"> |
| 92 |
<xsl:param name="width" select="@type"></xsl:param> |
| 93 |
<xsl:choose> |
| 94 |
<xsl:when test="count(./alias)>0"> |
| 95 |
|
| 96 |
<xsl:for-each select="./alias"> |
| 97 |
<xsl:call-template name="alias_template"> |
| 98 |
<xsl:with-param name="templateToCall">formats</xsl:with-param> |
| 99 |
<xsl:with-param name="source" select="@source"></xsl:with-param> |
| 100 |
<xsl:with-param name="xpath" select="@path"></xsl:with-param> |
| 101 |
<xsl:with-param name="width" select="$width"></xsl:with-param> |
| 102 |
</xsl:call-template> |
| 103 |
</xsl:for-each> |
| 104 |
</xsl:when> |
| 105 |
<xsl:otherwise> |
| 106 |
<xsl:choose> |
| 107 |
<xsl:when test="contains(name(),'Formats')"> |
| 108 |
<xsl:for-each select="*"> |
| 109 |
<xsl:call-template name="formats"></xsl:call-template> |
| 110 |
</xsl:for-each> |
| 111 |
</xsl:when> |
| 112 |
<xsl:otherwise> |
| 113 |
<xsl:if test="name()!='default'"> |
| 114 |
<xsl:if test="name()='currencySpacing'"> |
| 115 |
<xsl:call-template name="currencySpacing"></xsl:call-template> |
| 116 |
</xsl:if><xsl:for-each select=".//pattern[not(@draft)] | |
| 117 |
.//pattern[@draft!='provisional' and @draft!='unconfirmed']"> |
| 118 |
<xsl:call-template name="insert_comma"/> |
| 119 |
'<xsl:value-of select="name(..)"></xsl:value-of> |
| 120 |
<xsl:if test="string-length($width)>0"> |
| 121 |
<xsl:text>-</xsl:text> |
| 122 |
<xsl:value-of select="$width"></xsl:value-of> |
| 123 |
</xsl:if> |
| 124 |
<xsl:text>':"</xsl:text><xsl:value-of select="replace(.,'"', '\\"')"/> |
| 125 |
<xsl:text>"</xsl:text> |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
</xsl:for-each> |
| 131 |
</xsl:if> |
| 132 |
</xsl:otherwise> |
| 133 |
</xsl:choose> |
| 134 |
</xsl:otherwise> |
| 135 |
</xsl:choose> |
| 136 |
</xsl:template> |
| 137 |
|
| 138 |
|
| 139 |
<xsl:template name="currencySpacing"> |
| 140 |
<xsl:choose> |
| 141 |
<xsl:when test="count(./alias)>0"> |
| 142 |
|
| 143 |
<xsl:for-each select="./alias"> |
| 144 |
<xsl:call-template name="alias_template"> |
| 145 |
<xsl:with-param name="templateToCall">symbols</xsl:with-param> |
| 146 |
<xsl:with-param name="source" select="@source"></xsl:with-param> |
| 147 |
<xsl:with-param name="xpath" select="@path"></xsl:with-param> |
| 148 |
</xsl:call-template> |
| 149 |
</xsl:for-each> |
| 150 |
</xsl:when> |
| 151 |
<xsl:otherwise> |
| 152 |
<xsl:choose> |
| 153 |
<xsl:when test="name()='currencySpacing' |
| 154 |
or name()='beforeCurrency' |
| 155 |
or name()='afterCurrency'" > |
| 156 |
<xsl:for-each select="*"> |
| 157 |
<xsl:call-template name="currencySpacing"></xsl:call-template> |
| 158 |
</xsl:for-each> |
| 159 |
</xsl:when> |
| 160 |
<xsl:otherwise> |
| 161 |
<xsl:if test=".[(not(@draft) or @draft!='provisional' and @draft!='unconfirmed')]"> |
| 162 |
<xsl:call-template name="insert_comma"/> |
| 163 |
'<xsl:value-of select="name(../..)"></xsl:value-of> |
| 164 |
<xsl:text>-</xsl:text> |
| 165 |
<xsl:value-of select="name(..)"></xsl:value-of> |
| 166 |
<xsl:text>-</xsl:text> |
| 167 |
<xsl:value-of select="name()"></xsl:value-of> |
| 168 |
<xsl:text>':"</xsl:text> |
| 169 |
<xsl:value-of select="replace(.,'"', '\\"')"></xsl:value-of> |
| 170 |
<xsl:text>"</xsl:text> |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
</xsl:if> |
| 178 |
</xsl:otherwise> |
| 179 |
</xsl:choose> |
| 180 |
</xsl:otherwise> |
| 181 |
</xsl:choose> |
| 182 |
</xsl:template> |
| 183 |
|
| 184 |
<xsl:template name="ignore" match="defaultNumberingSystem | otherNumberingSystems | currencies | miscPatterns | minimumGroupingDigits | minimalPairs"></xsl:template> |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
<xsl:template name="invoke_template_by_name"> |
| 189 |
<xsl:param name="templateName"></xsl:param> |
| 190 |
<xsl:param name="name"></xsl:param> |
| 191 |
<xsl:param name="width"></xsl:param> |
| 192 |
<xsl:param name="ctx"></xsl:param> |
| 193 |
<xsl:param name="fromLocaleAlias"></xsl:param> |
| 194 |
<xsl:if test="$templateName='top'"> |
| 195 |
<xsl:call-template name="top"></xsl:call-template> |
| 196 |
</xsl:if> |
| 197 |
<xsl:if test="$templateName='numbers'"> |
| 198 |
<xsl:call-template name="numbers"></xsl:call-template> |
| 199 |
</xsl:if> |
| 200 |
<xsl:if test="$templateName='symbols'"> |
| 201 |
<xsl:call-template name="symbols"></xsl:call-template> |
| 202 |
</xsl:if> |
| 203 |
<xsl:if test="$templateName='formats'"> |
| 204 |
<xsl:call-template name="formats"> |
| 205 |
<xsl:with-param name="width" select="$width"></xsl:with-param> |
| 206 |
</xsl:call-template> |
| 207 |
</xsl:if> |
| 208 |
<xsl:if test="$templateName='currencySpacing'"> |
| 209 |
<xsl:call-template name="currencySpacing"></xsl:call-template> |
| 210 |
</xsl:if> |
| 211 |
</xsl:template> |
| 212 |
</xsl:stylesheet> |