comparison xslt/text-tools.xsl @ 0:cbdada054b4a

Basic schemas for generating csharp internal dom from model definition
author cin
date Wed, 21 Feb 2018 03:01:53 +0300
parents
children 7f803979305f
comparison
equal deleted inserted replaced
-1:000000000000 0:cbdada054b4a
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <!-- TEXT ROUTINES -->
5 <xsl:template name="write-line">
6 <xsl:param name="level" select="0" />
7 <xsl:param name="text" />
8 <xsl:call-template name="indent">
9 <xsl:with-param name="level" select="$level" />
10 </xsl:call-template>
11 <xsl:value-of select="$text" />
12 <xsl:text>&#xa;</xsl:text>
13 </xsl:template>
14
15 <xsl:template name="indent">
16 <xsl:param name="level" select="0" />
17 <xsl:if test="$level > 0">
18 <xsl:text> </xsl:text>
19 <xsl:call-template name="indent">
20 <xsl:with-param name="level" select="$level - 1" />
21 </xsl:call-template>
22 </xsl:if>
23 </xsl:template>
24
25 <xsl:template name="to-lower-first">
26 <xsl:param name="value" />
27 <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
28 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
29 <xsl:variable name="before" select="substring($value,1,1)" />
30 <xsl:variable name="after" select="substring($value,2)" />
31 <xsl:value-of
32 select="concat(translate($before,$uppercase,$smallcase), $after)" />
33 </xsl:template>
34
35 <xsl:template name="to-lower">
36 <xsl:param name="value" />
37 <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
38 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
39 <xsl:value-of select="translate($value,$uppercase,$smallcase)" />
40 </xsl:template>
41 </xsl:stylesheet>