XSL Utility: Strip HTML From A Given Value
From VYRE
Sometimes you may need to strip the HTML out of a block of text rather than just escaping the output. The following template does so, based on "<" and then ">" being present.
<xsl:template name="strip_HTML"> <xsl:param name="value"/> <xsl:choose> <xsl:when test="contains($value,'<')"> <xsl:value-of select="substring-before($value,'<')" disable-output-escaping="yes"/> <xsl:choose> <xsl:when test="contains(substring-after($value,'<'),'>')"> <xsl:call-template name="strip_HTML"> <xsl:with-param name="value"><xsl:value-of select="substring-after($value,'>')"/></xsl:with-param> </xsl:call-template> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="$value" disable-output-escaping="yes"/> </xsl:otherwise> </xsl:choose> </xsl:template>
