Mercurial > pub > ModelGenerator
annotate 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 |
rev | line source |
---|---|
0
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
1 <?xml version="1.0" encoding="UTF-8"?> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
2 <xsl:stylesheet version="1.0" |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
4 <!-- TEXT ROUTINES --> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
5 <xsl:template name="write-line"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
6 <xsl:param name="level" select="0" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
7 <xsl:param name="text" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
8 <xsl:call-template name="indent"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
9 <xsl:with-param name="level" select="$level" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
10 </xsl:call-template> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
11 <xsl:value-of select="$text" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
12 <xsl:text>
</xsl:text> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
13 </xsl:template> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
14 |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
15 <xsl:template name="indent"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
16 <xsl:param name="level" select="0" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
17 <xsl:if test="$level > 0"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
18 <xsl:text> </xsl:text> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
19 <xsl:call-template name="indent"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
20 <xsl:with-param name="level" select="$level - 1" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
21 </xsl:call-template> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
22 </xsl:if> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
23 </xsl:template> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
24 |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
25 <xsl:template name="to-lower-first"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
26 <xsl:param name="value" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
27 <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
28 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
29 <xsl:variable name="before" select="substring($value,1,1)" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
30 <xsl:variable name="after" select="substring($value,2)" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
31 <xsl:value-of |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
32 select="concat(translate($before,$uppercase,$smallcase), $after)" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
33 </xsl:template> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
34 |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
35 <xsl:template name="to-lower"> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
36 <xsl:param name="value" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
37 <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
38 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
39 <xsl:value-of select="translate($value,$uppercase,$smallcase)" /> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
40 </xsl:template> |
cbdada054b4a
Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff
changeset
|
41 </xsl:stylesheet> |