Changeset 2805


Ignore:
Timestamp:
Jan 12, 2013, 6:29:41 AM (9 years ago)
Author:
Александър Шопов
Message:

Статистиката поддържа пореден номер чрез разширение на JavaScript? - apachec bsf & logging commons

Location:
scripts/xml-stats
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/xml-stats/format.xsl

    r2768 r2805  
    55xmlns:dyn="http://exslt.org/dynamic"
    66xmlns:str="http://exslt.org/strings"
    7 
    8 extension-element-prefixes="math dyn str">
     7xmlns:xalan="http://xml.apache.org/xalan"
     8xmlns:counter="counter"
     9
     10extension-element-prefixes="math dyn str counter">
     11
     12<xalan:component prefix="counter" elements="next">
     13<xalan:script lang="javascript">
     14var counters = {};
     15function next(name){
     16    if(!counters[name]){
     17        counters[name] = 1;
     18    } else {
     19        counters[name]+=1;
     20    }
     21    return counters[name];
     22}
     23</xalan:script>
     24</xalan:component>
     25
    926
    1027<xsl:variable name="nl">
     
    1936
    2037<xsl:output encoding="UTF-8" method="text"/>
     38<xsl:variable name="maxCountLength" select="string-length(string(count(//domain)))" />
    2139<xsl:variable name="maxNameLength" select="dyn:max(//domain, 'string-length(concat(../@id,translate(boolean(substring-after(@id,$po-prefix)),$true-false-replace,$dot),substring-after(@id,$po-prefix)))')" />
    2240<xsl:variable name="maxBranchLength" select="dyn:max(//domain, 'string-length(../@branch)')" />
     
    3149<!-- DEBUG -->
    3250<!--
     51<xsl:value-of select="$maxCountLength"/>@maxCountLength
    3352<xsl:value-of select="$maxNameLength"/>@maxNameLength
    3453<xsl:value-of select="$maxBranchLength"/>@maxBranchLength
     
    96115
    97116<xsl:call-template name="draw-line">
     117<xsl:with-param name="number" select="counter:next($type)"></xsl:with-param>
     118<xsl:with-param name="numberLength" select="$maxCountLength"/>
    98119<xsl:with-param name="name" select="concat(../@id,translate(boolean(substring-after(@id,$po-prefix)),$true-false-replace,$dot),substring-after(@id,$po-prefix))"/>
    99120<xsl:with-param name="nameLength" select="$maxNameLength"/>
     
    124145
    125146<xsl:template name="draw-line">
     147<xsl:param name="number"/>
     148<xsl:param name="numberLength"/>
    126149<xsl:param name="name"/>
    127150<xsl:param name="nameLength"/>
     
    143166<!-- DEBUG -->
    144167<!--
     168<xsl:value-of select="$number"/>#number
     169<xsl:value-of select="$numberLength"/>#numberLength
    145170<xsl:value-of select="$name"/>#name
    146171<xsl:value-of select="$nameLength"/>#nameLength
     
    161186-->
    162187
    163 
     188<xsl:value-of select="str:align($number,str:padding($numberLength+1,$pad),'right')"/>
     189<xsl:value-of select="$separator"/>
    164190<xsl:value-of select="str:align($name,str:padding($nameLength+1,$pad),'left')"/>
    165191<xsl:value-of select="$separator"/>
     
    183209<xsl:template name="draw-separator">
    184210<xsl:call-template name="draw-line">
     211<xsl:with-param name="number" select="''"/>
     212<xsl:with-param name="numberLength" select="$maxCountLength"/>
    185213<xsl:with-param name="name" select="''"/>
    186214<xsl:with-param name="nameLength" select="$maxNameLength"/>
     
    204232<xsl:template name="draw-heading">
    205233<xsl:call-template name="draw-line">
     234<xsl:with-param name="number" select="'Номер'"/>
     235<xsl:with-param name="numberLength" select="$maxCountLength"/>
    206236<xsl:with-param name="name" select="'Име'"/>
    207237<xsl:with-param name="nameLength" select="$maxNameLength"/>
     
    226256<xsl:template name="draw-footer">
    227257<xsl:call-template name="draw-line">
     258<xsl:with-param name="number" select="''"/>
     259<xsl:with-param name="numberLength" select="$maxCountLength"/>
    228260<xsl:with-param name="name" select="'Общо'"/>
    229261<xsl:with-param name="nameLength" select="$maxNameLength"/>
     
    247279<xsl:template name="draw-ellipsis">
    248280<xsl:call-template name="draw-line">
     281<xsl:with-param name="number" select="''"/>
     282<xsl:with-param name="numberLength" select="$maxCountLength"/>
    249283<xsl:with-param name="name" select="''"/>
    250284<xsl:with-param name="nameLength" select="$maxNameLength"/>
  • scripts/xml-stats/print-stats.sh

    r2768 r2805  
    44
    55TMP=`mktemp`
    6 CP="/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar"
     6CP="/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar:/usr/share/java/bsf.jar:/usr/share/java/commons-logging.jar:/usr/share/java/js.jar"
    77ED=$1; shift
    88wget http://l10n.gnome.org/languages/bg/$ED/xml -O $TMP
Note: See TracChangeset for help on using the changeset viewer.