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

Re: match text node

Subject: Re: [xsl] match text node
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 13 Oct 2003 07:19:08 -0700 (PDT)
xsl template match text
> 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.

You do not need sophisticated string-replacement locic to delete a single
character.

In a template matching any text node and overriding the identity rule use
the translate function like this:


<xsl:stylesheet version="1.0" 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 <xsl:output omit-xml-declaration="yes"/>
  
  <xsl:template match="node() | @*">
    <xsl:copy>
      <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
  </xsl:template>
  
  <xsl:template match="text()">
    <xsl:value-of select="translate(., '&#xA;', '')"/>
  </xsl:template>
</xsl:stylesheet>





=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

 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.