[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with < and > in front and after CDAT
jo lemen schrieb:
Is there a way in XSL 1.0 to fix the < and > in front of and after the CDATA section? <rss version="2.0"> <item> <title>Title text</title> <link>URL</link> <description><![CDATA[description text]]></description> <pubDate>pubDate</pubDate> </item>
12:12:30,45 C:\MILU\dev\XSLT-1 # more cdata-unparsed.pl use strict; use warnings; use XML::LibXML; my $doc = XML::LibXML::Document->new; my $root = $doc->createElement( 'Urmel'); $doc->setDocumentElement( $root); my $text = 'Eene & meene <und> miste'; my $node1 = $doc->createElement('eins'); $node1->appendTextNode( "<![CDATA[$text]]>"); # wrong $root->appendChild( $node1); my $node2 = $doc->createElement('zwei'); $node2->appendChild( XML::LibXML::CDATASection->new( $text)); # right $root->appendChild( $node2); print $doc->serialize(1), "\n";
Supposing this error is predictable and reliable, can't this be safely undone using one simple d-o-e attribute for the element in question? <xsl:template match="description"> <xsl:copy> <xsl:value-of select="." disable-output-escaping="yes"/> </xsl:copy> </xsl:template> Michael Ludwig
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|