annotate xslt/text-tools.xsl @ 9:d3542662cf70

working on members preprocessing
author cin
date Sun, 11 Mar 2018 10:27:32 +0300
parents 7f803979305f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
1
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://implab.org/schemas/temp"
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
4 xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
0
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
5 <!-- TEXT ROUTINES -->
1
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
6 <xsl:template name="writeLine">
0
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
7 <xsl:param name="level" select="0" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
8 <xsl:param name="text" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
9 <xsl:call-template name="indent">
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
10 <xsl:with-param name="level" select="$level" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
11 </xsl:call-template>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
12 <xsl:value-of select="$text" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
13 <xsl:text>&#xa;</xsl:text>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
14 </xsl:template>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
15
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
16 <xsl:template name="indent">
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
17 <xsl:param name="level" select="0" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
18 <xsl:if test="$level > 0">
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
19 <xsl:text> </xsl:text>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
20 <xsl:call-template name="indent">
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
21 <xsl:with-param name="level" select="$level - 1" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
22 </xsl:call-template>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
23 </xsl:if>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
24 </xsl:template>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
25
1
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
26 <xsl:template name="toLowerFirst">
0
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
27 <xsl:param name="value" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
28 <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
29 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
30 <xsl:variable name="before" select="substring($value,1,1)" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
31 <xsl:variable name="after" select="substring($value,2)" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
32 <xsl:value-of
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
33 select="concat(translate($before,$uppercase,$smallcase), $after)" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
34 </xsl:template>
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
35
1
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
36 <xsl:template name="toLower">
0
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
37 <xsl:param name="value" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
38 <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
39 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
40 <xsl:value-of select="translate($value,$uppercase,$smallcase)" />
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
41 </xsl:template>
1
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
42
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
43 <xsl:template name="warn">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
44 <xsl:param name="msg" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
45 <xsl:message terminate="no">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
46 <xsl:apply-templates select="exsl:node-set($msg)"
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
47 mode="trace" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
48 </xsl:message>
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
49 </xsl:template>
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
50
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
51 <xsl:template name="error">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
52 <xsl:param name="msg" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
53 <xsl:message terminate="no">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
54 <xsl:apply-templates select="exsl:node-set($msg)"
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
55 mode="trace" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
56 </xsl:message>
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
57 </xsl:template>
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
58
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
59 <xsl:template match="t:trace" mode="trace">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
60 <xsl:param name="level" select="0" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
61 <xsl:call-template name="writeLine">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
62 <xsl:with-param name="text" select="@msg" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
63 <xsl:with-param name="level" select="$level" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
64 </xsl:call-template>
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
65 <xsl:apply-templates mode="trace">
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
66 <xsl:with-param name="level" select="$level + 1" />
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
67 </xsl:apply-templates>
7f803979305f improved cs-dom generation, added getMember, getKeyMember templates
cin
parents: 0
diff changeset
68 </xsl:template>
0
cbdada054b4a Basic schemas for generating csharp internal dom from model definition
cin
parents:
diff changeset
69 </xsl:stylesheet>