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/calendar.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 
     
    78<xsl:strip-space elements="*"/>  
    89 
    9 <xsl:variable name="first" select="true()" saxon:assignable="yes"/> 
    10      
    1110<xsl:template match="/"> 
    1211     <xsl:apply-templates/> 
     
    453452</xsl:template> 
    454453     
    455 <!-- Sub output routine--> 
    456 <xsl:variable name="vLowercaseChars_CONST" select="'abcdefghijklmnopqrstuvwxyz'"/>  
    457 <xsl:variable name="vUppercaseChars_CONST" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> 
    458 <xsl:template name="camel_case"> 
    459     <xsl:param name="name"></xsl:param> 
    460     <xsl:variable name="words" select="tokenize($name, '-')"></xsl:variable> 
    461     <xsl:for-each select="$words"> 
    462         <xsl:choose> 
    463             <xsl:when test="position()=1"> 
    464                 <xsl:value-of select="."/> 
    465             </xsl:when> 
    466             <xsl:otherwise> 
    467                 <xsl:value-of select="translate(substring(., 1, 1), $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/><xsl:value-of select="substring(., 2)"/> 
    468             </xsl:otherwise> 
    469         </xsl:choose> 
    470     </xsl:for-each> 
    471 </xsl:template> 
    472  
    473 <!-- recursive process for alias --> 
    474 <xsl:template name="alias_template"> 
    475     <xsl:param name="templateToCall"></xsl:param> 
    476     <xsl:param name="source"></xsl:param> 
    477     <xsl:param name="xpath"></xsl:param> 
    478      
    479     <xsl:variable name="cur_name" select="../name()"></xsl:variable> 
    480     <xsl:variable name="cur_width" select="../@type"></xsl:variable> 
    481      
    482     <xsl:choose> 
    483         <!-- source="locale" --> 
    484         <xsl:when test="$source='locale'"> 
    485             <xsl:for-each select="saxon:evaluate(concat('../',$xpath))">    
    486                 <xsl:call-template name="invoke_template_by_name"> 
    487                     <xsl:with-param name="templateName" select="$templateToCall"></xsl:with-param> 
    488                     <xsl:with-param name="name" select="$cur_name"></xsl:with-param> 
    489                     <xsl:with-param name="width" select="$cur_width"></xsl:with-param> 
    490                 </xsl:call-template> 
    491             </xsl:for-each> 
    492         </xsl:when> 
    493         <xsl:otherwise> 
    494             <!-- source is an external xml file --> 
    495             <xsl:if test="string-length($xpath)>0"> 
    496                 <xsl:for-each select="doc(concat('ldml/core/main/',concat($source,'.xml')))">  
    497                     <xsl:for-each select="saxon:evaluate($xpath)"> 
    498                        <xsl:call-template name="invoke_template_by_name"> 
    499                            <xsl:with-param name="templateName" select="$templateToCall"></xsl:with-param> 
    500                            <xsl:with-param name="name" select="$cur_name"></xsl:with-param> 
    501                            <xsl:with-param name="width" select="$cur_width"></xsl:with-param> 
    502                        </xsl:call-template> 
    503                   </xsl:for-each> 
    504                 </xsl:for-each> 
    505             </xsl:if>             
    506         </xsl:otherwise> 
    507     </xsl:choose> 
    508 </xsl:template>    
    509      
    510454  <!-- too bad that can only use standard xsl:call-template(name can not be variable)  
    511455         error occurs if use <saxson:call-templates($templateToCall)  /> --> 
     
    549493     </xsl:if>      
    550494 </xsl:template> 
    551      
    552 <xsl:template name="insert_comma"> 
    553     <xsl:choose> 
    554         <xsl:when test="$first"> 
    555             <saxon:assign name="first" select="false()"/> 
    556         </xsl:when> 
    557         <xsl:otherwise> 
    558             <xsl:text>,</xsl:text> 
    559         </xsl:otherwise> 
    560     </xsl:choose> 
    561 </xsl:template> 
    562      
    563495</xsl:stylesheet>