[xsl] match text node

Subject: [xsl] match text node
From: Евгения Фирсова <saigo@xxxxxxxxxxxxx>
Date: Mon, 13 Oct 2003 16:11:25 +0400
Hello,

I have document like:
<Descr>
       valid html
</Descr>
"valid html" - I mean every html (xml-valid) you can imagine with no
limitation at all. Of course, there are some texts. And there may be
any nodes inside text and so on.

My task: I need to copy whole document (all nodes and all attributes)
but in text nodes I need to delete all &#xA; marks.

Template to delete &#xA; marks:
<xsl:template name="replace" match="text()" mode="replace">
        <xsl:param name="str" select="."/>
        <xsl:param name="search-for" select="'&#xA;'"/>
        <xsl:param name="replace-with">
                   <xsl:text/>
        </xsl:param>
        <xsl:choose>
                <xsl:when test="contains($str,$search-for)">
                        <xsl:value-of select="substring-before($str,$search-for)"/>
                        <xsl:copy-of select="$replace-with"/>
                        <xsl:call-template name="replace">
                                <xsl:with-param name="str" select="substring-after($str,$search-for)"/>
                                <xsl:with-param name="search-for" select="$search-for"/>
                                <xsl:with-param name="replace-with" select="$replace-with"/>
                        </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                        <xsl:value-of select="$str"/>
                </xsl:otherwise>
        </xsl:choose>
</xsl:template>

The problem is I don't know how to apply it correctly.

Please, help me to solve this problem.

-- 
 Yours sincerely, Evgenia Firsova (saigo@xxxxxxxxxxxxx)
 ---------------------------------------------------
 NEVA Travel Company    http://www.nevatravel.ru/  
 Russia, St.Petersburg, 1st. Sovetskaya str. 8
 fax +7 (812) 327-3267  phone +7 (812) 277-4212


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread