comparison gpf/util/sape/xslt/utilities.xsl @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <xsl:import href="format.xsl"/>
4 <!--named template to format a command line message-->
5 <xsl:template name="cmdLineMsg">
6 <xsl:param name="msgType"/>
7 <xsl:param name="msg"/>
8 <xsl:choose>
9 <xsl:when test='$msgType="error"'>
10 <xsl:text>### FATAL ERROR: </xsl:text>
11 </xsl:when>
12 <xsl:when test='$msgType="warning"'>
13 <xsl:text>### WARNING: </xsl:text>
14 </xsl:when>
15 <xsl:when test='$msgType="info"'>
16 <xsl:text>### INFO: </xsl:text>
17 </xsl:when>
18 </xsl:choose>
19 <xsl:value-of select="$msg"/>
20 <xsl:value-of select="$newline"/>
21 </xsl:template>
22 <!--named template to convert string characters into lower case-->
23 <xsl:template name="toLower">
24 <xsl:param name="str"/>
25 <xsl:value-of select="translate($str, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' )"/>
26 </xsl:template>
27 <!--named template to convert string characters into upper case-->
28 <xsl:template name="toUpper">
29 <xsl:param name="str"/>
30 <xsl:value-of select="translate($str, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' )"/>
31 </xsl:template>
32 <!--named template to add the number type prefix for a Value element-->
33 <xsl:template name="getValPrefix">
34 <xsl:param name="valType"/>
35 <xsl:choose>
36 <xsl:when test='$valType="DEC"'/>
37 <xsl:when test='$valType="ALPHA"'/>
38 <xsl:when test='$valType="HEX"'>
39 <xsl:text>0x</xsl:text>
40 </xsl:when>
41 <xsl:when test='$valType="BIN"'>
42 <xsl:text>0b</xsl:text>
43 </xsl:when>
44 <xsl:when test='$valType="OCT"'>
45 <xsl:text>0</xsl:text>
46 </xsl:when>
47 <xsl:otherwise>
48 <xsl:message terminate="yes">
49 <xsl:call-template name="cmdLineMsg">
50 <xsl:with-param name="msgType" select="error"/>
51 <xsl:with-param name="msg">
52 <xsl:text>Value.@ValueType is neither DEC nor ALPHA nor HEX nor BIN nor OCT</xsl:text>
53 </xsl:with-param>
54 </xsl:call-template>
55 </xsl:message>
56 </xsl:otherwise>
57 </xsl:choose>
58 </xsl:template>
59 </xsl:stylesheet>