| 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="displayName symbol"/> |
| 8 |
<xsl:strip-space elements="*"/> |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
<xsl:param name="currencyList"></xsl:param> |
| 14 |
|
| 15 |
<xsl:template match="/"> |
| 16 |
<xsl:apply-templates/> |
| 17 |
</xsl:template> |
| 18 |
|
| 19 |
|
| 20 |
<xsl:template name="top" match="/ldml"> |
| 21 |
<xsl:choose> |
| 22 |
<xsl:when test="count(./alias)>0"> |
| 23 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 88 |
|
| 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(.,'"', '\\"')"></xsl:value-of> |
| 98 |
<xsl:text>"</xsl:text> |
| 99 |
</xsl:for-each> |
| 100 |
</xsl:otherwise> |
| 101 |
</xsl:choose> |
| 102 |
</xsl:template> |
| 103 |
|
| 104 |
|
| 105 |
|
| 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> |