-
-<!-- Next function to quote strings for JavaScript (i.e. ' ==> \' -->
-<xsl:template name="jsquote">
- <xsl:param name="s" select="''"/>
- <xsl:param name="news" select="''"/>
- <xsl:choose>
- <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
- <xsl:otherwise>
- <xsl:variable name="char" select="substring($s,1,1)"/>
- <xsl:choose>
- <xsl:when test='$char = "'"'>
- <xsl:call-template name="jsquote">
- <xsl:with-param name="s" select="substring($s,2)"/>
- <xsl:with-param name="news" select='concat($news,"\\\'")'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="jsquote">
- <xsl:with-param name="s" select="substring($s,2)"/>
- <xsl:with-param name="news" select="concat($news,$char)"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>