Hi Michael,
"1. I've no idea what your js_escapeAmp does or why you need it. Normally you should be using the HTML output method and that should take care of all escaping that's needed."
I have always had problems escaping characters in my xml with xslt.
The js_escapeAmp template just escapes an ampersand.
Could you please elaborate a bit more on this bit of your comment. I get the xml I need from a call to a web service and then use the xslt to transform this xml on the client using javascript. What do you mean by using the HTTP output method? I already use
<xsl:output method="html"/> in my xslt.
"you should be using the HTML output method and that should take care of all escaping that's needed."
Thanks
<xsl:template name="
js-escapeAmp">
<xsl:param name="string" />
<xsl:call-template name="substitute">
<xsl:with-param name="string" select="normalize-space($string)" />
<xsl:with-param name="find" select='"%26amp%3B"' />
<xsl:with-param name="replace" select='"&"' />
</xsl:call-template>
</xsl:template>
<xsl:template name="substitute">
<xsl:param name="string" />
<xsl:param name="find" />
<xsl:param name="replace" />
<xsl:choose>
<xsl:when test="$find and $string and contains($string, $find)">
<xsl:value-of select="substring-before($string, $find)" />
<xsl:value-of select="$replace" />
<xsl:call-template name="substitute">
<xsl:with-param name="string" select="substring-after($string,$find)" />
<xsl:with-param name="find" select="$find" />
<xsl:with-param name="replace" select="$replace" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>