Hi All,
In my identity template, where I need to replace "#" for downstream
processing, but I want to keep rest of the html entities which
might have "#" in them uninterrupted. Please help me , how do I
resolve this riddle?
This is my xslt for the same.
Thanks in advance for your input.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:choose>
<xsl:when test="text()[contains(.,'&#')]">
<xsl:copy>
<xsl:apply-templates select="."/>
</xsl:copy> </xsl:when>
<xsl:when test="text()[contains(.,'#')]">
<xsl:variable name="hash">#</xsl:variable>
<xsl:variable name="cleaned">
<xsl:call-template name="_replace_string">
<xsl:with-param name="string" select="." />
<xsl:with-param name="find" select="$hash" />
<xsl:with-param name="replace" select="'&#x23;'" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$cleaned" />
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="."/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Thanks
Senthil
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--