source: Dev/trunk/src/client/util/buildscripts/cldr/util.xsl @ 483

Last change on this file since 483 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 4.4 KB
Line 
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
4    <xsl:variable name="first" select="true()" saxon:assignable="yes"/>
5    <xsl:variable name="basedirsansslash" saxon:assignable="yes"/>
6
7    <xsl:param name="basedir"></xsl:param>
8
9    <xsl:template name="insert_comma">
10            <xsl:choose>
11                    <xsl:when test="$first">
12                            <saxon:assign name="first" select="false()"/>
13                </xsl:when>
14            <xsl:otherwise>
15                            <xsl:text>,</xsl:text>
16            </xsl:otherwise>
17        </xsl:choose>
18    </xsl:template>
19
20    <!-- Sub output routine-->
21    <xsl:variable name="vLowercaseChars_CONST" select="'abcdefghijklmnopqrstuvwxyz'"/>
22    <xsl:variable name="vUppercaseChars_CONST" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
23    <xsl:template name="camel_case">
24        <xsl:param name="name"></xsl:param>
25        <xsl:variable name="words" select="tokenize($name, '-')"></xsl:variable>
26        <xsl:for-each select="$words">
27            <xsl:choose>
28                <xsl:when test="position()=1">
29                    <xsl:value-of select="."/>
30                </xsl:when>
31                <xsl:otherwise>
32                    <xsl:value-of select="translate(substring(., 1, 1), $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/><xsl:value-of select="substring(., 2)"/>
33                </xsl:otherwise>
34            </xsl:choose>
35        </xsl:for-each>
36    </xsl:template>
37
38    <!--xsl:template name="invoke_template_by_name">
39        <xsl:param name="templateName"></xsl:param>
40        <xsl:param name="name"></xsl:param>
41        <xsl:param name="width"></xsl:param>
42    </xsl:template-->
43
44    <!-- recursive process for alias -->
45    <xsl:template name="alias_template">
46        <xsl:param name="templateToCall"></xsl:param>
47        <xsl:param name="source"></xsl:param>
48        <xsl:param name="xpath"></xsl:param>
49        <xsl:param name="name"></xsl:param>
50        <xsl:param name="width"></xsl:param>
51        <xsl:param name="ctx"></xsl:param>
52        <xsl:choose>           
53            <xsl:when test="compare($source,'locale')=0">
54                <!-- source="locale" -->
55                <xsl:for-each select="saxon:evaluate(concat('../',$xpath))">   
56                    <xsl:call-template name="invoke_template_by_name">
57                        <xsl:with-param name="templateName" select="$templateToCall"></xsl:with-param>
58                        <xsl:with-param name="name" select="$name"></xsl:with-param>
59                        <xsl:with-param name="width" select="$width"></xsl:with-param>
60                        <xsl:with-param name="ctx" select="$ctx"></xsl:with-param>
61                        <xsl:with-param name="fromLocaleAlias" select="true()"></xsl:with-param>
62                    </xsl:call-template>
63                </xsl:for-each>
64            </xsl:when>
65            <xsl:otherwise>
66                <!-- source is an external xml file -->
67                <xsl:if test="string-length($xpath)>0">
68                    <xsl:choose>
69                        <xsl:when test="starts-with($basedir, '/')">
70                            <saxon:assign name="basedirsansslash" select="substring($basedir, 2)"/>
71                        </xsl:when>
72                        <xsl:otherwise>
73                            <saxon:assign name="basedirsansslash" select="$basedir"/>
74                        </xsl:otherwise>
75                    </xsl:choose>
76                        <xsl:for-each select="doc(concat('file:///',concat($basedirsansslash,concat($source,'.xml'))))">
77                        <xsl:for-each select="saxon:evaluate($xpath)">
78                            <xsl:call-template name="invoke_template_by_name">
79                                <xsl:with-param name="templateName" select="$templateToCall"></xsl:with-param>
80                                <xsl:with-param name="name" select="$name"></xsl:with-param>
81                                <xsl:with-param name="width" select="$width"></xsl:with-param>
82                                <xsl:with-param name="ctx" select="$ctx"></xsl:with-param>
83                                <xsl:with-param name="fromLocaleAlias" select="false()"></xsl:with-param>
84                            </xsl:call-template>
85                        </xsl:for-each>
86                    </xsl:for-each>
87                </xsl:if>           
88            </xsl:otherwise>
89        </xsl:choose>
90    </xsl:template>   
91</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.