Ticket #801: templates_sorter.diff

File templates_sorter.diff, 1.5 KB (added by fcxSanya, 13 years ago)
  • source/tools/templatessorter/templatessorter.xsl

     
     1<xsl:stylesheet
     2  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     3  version="1.0">
     4
     5  <xsl:output indent="yes"/>
     6
     7  <xsl:template match="@* | node()">
     8    <xsl:copy>
     9      <xsl:apply-templates select="@* | node()"/>
     10    </xsl:copy>
     11  </xsl:template>
     12
     13  <xsl:template match="Entity">
     14    <xsl:copy>
     15      <xsl:apply-templates select="@*"/>
     16      <xsl:apply-templates select="*">
     17        <xsl:sort select="local-name()"/>
     18      </xsl:apply-templates>
     19    </xsl:copy>
     20  </xsl:template>
     21
     22</xsl:stylesheet>
     23
  • source/tools/templatessorter/templatessorter.sh

     
     1#!/bin/bash
     2# check arguments count
     3if [ $# -ne 1 ]; then
     4  echo 'usage: '$0' directory'
     5  exit
     6fi
     7# assign arguments to variables with readable names
     8input_directory=$1
     9# perform work
     10find $input_directory -name \*.xml -exec xsltproc -o {} templatessorter.xsl {} \;
     11