Revision: 27169
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 26, 2010 06:41 by iroybot
Initial Code
<xsl:template match="text"> <xsl:variable name="apos">'</xsl:variable> <xsl:variable name="cleaned"> <xsl:call-template name="_replace_string"> <xsl:with-param name="string" select="." /> <xsl:with-param name="find" select="$apos" /> <xsl:with-param name="replace" select="'&apos;'" /> </xsl:call-template> </xsl:variable> <xsl:value-of select="$cleaned" /> </xsl:template> <xsl:template name="_replace_string"> <xsl:param name="string" select="''"/> <xsl:param name="find" select="''"/> <xsl:param name="replace" select="''"/> <xsl:choose> <xsl:when test="contains($string,$find)"> <xsl:value-of select="concat(substring-before($string,$find),$replace)"/> <xsl:call-template name="_replace_string"> <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>
Initial URL
Initial Description
replacing single quotes with its (double-escaped) entity, for use of a text within xsl.
Initial Title
Replace single quotes
Initial Tags
php
Initial Language
XSLT