Re: [xsl] match text node

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

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

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


Dimitre Novatchev. -- the home of FXSL

Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

 XSL-List info and archive:

Current Thread