(no commit message)
[utils] / crawler / kiss / conf / kiss / utilities.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- Note the declaration of the namespace for XInclude. -->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
5   xmlns:xi="http://www.w3.org/2001/XInclude">
6   
7   
8   <xsl:variable name="newline">
9     <xsl:text>&#10;</xsl:text>
10   </xsl:variable>
11   
12   <xsl:variable name="carriageReturn">
13     <xsl:text>&#13;&#10;</xsl:text>
14   </xsl:variable>
15
16   <!-- =====================================================
17     Replace one string by another
18     - src: string to do substituion in
19     - from: literal string to replace
20     - to:substitution string.
21     ======================================================-->
22   <xsl:template name="string-replace">
23     <xsl:param name="src"/>
24     <xsl:param name="from"/>
25     <xsl:param name="to"/>
26     <xsl:choose>
27       <xsl:when test="contains($src, $from)">
28         <xsl:value-of select="substring-before($src, $from)"/>
29         <xsl:value-of select="$to"/>
30         <xsl:call-template name="string-replace">
31           <xsl:with-param name="src" select="substring-after($src, $from)"/>
32           <xsl:with-param name="from" select="$from"/>
33           <xsl:with-param name="to" select="$to"/>
34         </xsl:call-template>
35       </xsl:when>
36       <xsl:otherwise>
37         <xsl:value-of select="$src"/>
38       </xsl:otherwise>
39     </xsl:choose>
40   </xsl:template>
41   
42 </xsl:stylesheet>