1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
6 This code is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License version 2 only, as
8 published by the Free Software Foundation.
9
10 This code is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 version 2 for more details (a copy is included in the LICENSE file that
14 accompanied this code).
15
16 You should have received a copy of the GNU General Public License version
17 2 along with this work; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 or visit www.oracle.com if you need additional information or have any
22 questions.
23 -->
57 <xsl:template name="string-replace-all">
58 <xsl:param name="text" />
59 <xsl:param name="replace" />
60 <xsl:param name="by" />
61 <xsl:choose>
62 <xsl:when test="contains($text, $replace)">
63 <xsl:value-of select="substring-before($text,$replace)" />
64 <xsl:value-of select="$by" />
65 <xsl:call-template name="string-replace-all">
66 <xsl:with-param name="text" select="substring-after($text,$replace)" />
67 <xsl:with-param name="replace" select="$replace" />
68 <xsl:with-param name="by" select="$by" />
69 </xsl:call-template>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="$text" />
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:template>
76
77
78 </xsl:stylesheet>
|
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
6 This code is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License version 2 only, as
8 published by the Free Software Foundation.
9
10 This code is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 version 2 for more details (a copy is included in the LICENSE file that
14 accompanied this code).
15
16 You should have received a copy of the GNU General Public License version
17 2 along with this work; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 or visit www.oracle.com if you need additional information or have any
22 questions.
23 -->
57 <xsl:template name="string-replace-all">
58 <xsl:param name="text" />
59 <xsl:param name="replace" />
60 <xsl:param name="by" />
61 <xsl:choose>
62 <xsl:when test="contains($text, $replace)">
63 <xsl:value-of select="substring-before($text,$replace)" />
64 <xsl:value-of select="$by" />
65 <xsl:call-template name="string-replace-all">
66 <xsl:with-param name="text" select="substring-after($text,$replace)" />
67 <xsl:with-param name="replace" select="$replace" />
68 <xsl:with-param name="by" select="$by" />
69 </xsl:call-template>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="$text" />
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:template>
76
77 <xsl:template name="maybecomma">
78 <xsl:if test="position()!=last()">
79 <xsl:text>,</xsl:text>
80 </xsl:if>
81 </xsl:template>
82
83 <xsl:template name="static_cast">
84 <xsl:param name="type"/>
85 <xsl:param name="content"/>
86 <xsl:text>static_cast<</xsl:text>
87 <xsl:value-of select="$type"/>
88 <xsl:text>>(</xsl:text>
89 <xsl:value-of select="$content"/>
90 <xsl:text>)</xsl:text>
91 </xsl:template>
92
93 <xsl:template name="mstr">
94 <xsl:param name="string"/>
95 <xsl:value-of select="concat('{ (u2)',string-length($string),', ')"/>
96 <xsl:value-of select="concat($quote,$string,$quote,' }')"/>
97 </xsl:template>
98
99 </xsl:stylesheet>
|