3 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5 <!-- Next function to quote strings for JavaScript (i.e. ' ==> \' -->
6 <xsl:template name="jsquote">
7 <xsl:param name="s" select="''"/>
8 <xsl:param name="news" select="''"/>
9 <xsl:param name="times" select="1"/>
11 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
13 <xsl:variable name="char" select="substring($s,1,1)"/>
15 <xsl:when test='$char = "'" and $times = 1'>
16 <xsl:call-template name="jsquote">
17 <xsl:with-param name="s" select="substring($s,2)"/>
18 <xsl:with-param name="news" select='concat($news,"\'")'/>
19 <xsl:with-param name="times" select="$times"/>
22 <xsl:when test='$char = "'" and $times = 2'>
23 <xsl:call-template name="jsquote">
24 <xsl:with-param name="s" select="substring($s,2)"/>
25 <xsl:with-param name="news" select='concat($news,"\\\'")'/>
26 <xsl:with-param name="times" select="$times"/>
30 <xsl:call-template name="jsquote">
31 <xsl:with-param name="s" select="substring($s,2)"/>
32 <xsl:with-param name="news" select="concat($news,$char)"/>
33 <xsl:with-param name="times" select="$times"/>