xsl-list
[Top] [All Lists]

Re: cdata()

2003-03-12 12:22:52
Hélder Sousa wrote:
I have an old xsl file that use the namespace <xsl:stylesheet 
xmlns:xsl="http://www.w3.org/TR/WD-xsl";> 
In this xsl is used the following code:

<xsl:for-each select="cdata()">
      <xsl:eval no-entities="1">this.nodeTypedValue</xsl:eval>
</xsl:for-each>

This code select all CDATA sections, using "cdata()", and write the value of 
each CDATA section. (this works fine!)
But using the namespace above I can't use "<xsl:call-template name="xpto">
So I use the namespace <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> but this don't recognize 
the "cdata()" function! 
Anyone can help me?

CDATA sections are not part of the XPath 1.0 data model. All adjacent
character data in an element, whether PCDATA or CDATA, becomes one text node.
You can select or match on a text node with text().

However I think you can replace the entire for-each with
<xsl:value-of select="."/>
or
<xsl:value-of seelct="text()"/>

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

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



<Prev in Thread] Current Thread [Next in Thread>
  • cdata(), Hélder Sousa
    • Re: cdata(), Mike Brown <=