[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

match text node

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.