Show
Ignore:
Timestamp:
04/02/07 06:50:55 (22 months ago)
Author:
peller
Message:

Refactor xslt utilities, generate localization json at dojo._cldr. Refs #2624

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/trunk/buildscripts/cldr/number.xsl

    r7897 r7906  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<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"/> 
    34<xsl:output method="text" indent="yes"/> 
    45<!-- list the data elements whose spaces should be preserved 
     
    67<xsl:preserve-space elements="decimal group list pattern currencyMatch surroundingMatch insertBetween"/> 
    78<xsl:strip-space elements="*"/>  
    8  
    9 <xsl:variable name="first" select="true()" saxon:assignable="yes"/> 
    109 
    1110<xsl:template match="/"> 
     
    178177      </xsl:choose> 
    179178</xsl:template> 
    180      
     179 
    181180<xsl:template name="currencies" match="currencies"></xsl:template> 
    182181 
    183 <!-- recursive process for alias --> 
    184 <xsl:template name="alias_template"> 
    185     <xsl:param name="templateToCall"></xsl:param> 
    186     <xsl:param name="source"></xsl:param> 
    187     <xsl:param name="xpath"></xsl:param> 
    188  
    189      <xsl:variable name="cur_width" select="../@type"></xsl:variable> 
    190    
    191     <xsl:choose> 
    192         <!-- source="locale" --> 
    193         <xsl:when test="$source='locale'"> 
    194             <xsl:for-each select="saxon:evaluate(concat('../',$xpath))">    
    195                 <xsl:call-template name="invoke_template_by_name"> 
    196                     <xsl:with-param name="templateName" select="$templateToCall"></xsl:with-param> 
    197                     <xsl:with-param name="width" select="$cur_width"></xsl:with-param> 
    198                 </xsl:call-template> 
    199             </xsl:for-each> 
    200         </xsl:when> 
    201         <xsl:otherwise> 
    202             <!-- source is an external xml file --> 
    203             <xsl:if test="string-length($xpath)>0"> 
    204                 <xsl:for-each select="doc(concat('ldml/core/main/',concat($source,'.xml')))">  
    205                     <xsl:for-each select="saxon:evaluate($xpath)"> 
    206                        <xsl:call-template name="invoke_template_by_name"> 
    207                            <xsl:with-param name="templateName" select="$templateToCall"></xsl:with-param> 
    208                            <xsl:with-param name="width" select="$cur_width"></xsl:with-param> 
    209                        </xsl:call-template> 
    210                   </xsl:for-each> 
    211                 </xsl:for-each> 
    212             </xsl:if>             
    213         </xsl:otherwise> 
    214     </xsl:choose> 
    215 </xsl:template>    
    216      
    217182  <!-- too bad that can only use standard xsl:call-template(name can not be variable)  
    218183         error occurs if use <saxson:call-templates($templateToCall)  /> --> 
    219184 <xsl:template name="invoke_template_by_name"> 
    220      <xsl:param name="templateName"></xsl:param>      
     185     <xsl:param name="templateName"></xsl:param> 
     186     <xsl:param name="name"></xsl:param>  
    221187     <xsl:param name="width"></xsl:param> 
    222188     <xsl:if test="$templateName='top'"> 
     
    238204     </xsl:if> 
    239205 </xsl:template> 
    240      
    241 <xsl:template name="insert_comma"> 
    242         <xsl:choose> 
    243                 <xsl:when test="$first"> 
    244                         <saxon:assign name="first" select="false()"/> 
    245                 </xsl:when> 
    246                 <xsl:otherwise> 
    247                         <xsl:text>,</xsl:text> 
    248                 </xsl:otherwise> 
    249         </xsl:choose> 
    250 </xsl:template> 
    251206</xsl:stylesheet>