[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL & CDATA Processing
At 2004-06-29 12:21 +1000, Rohit Mathur wrote:
I am trying to perform an XSL transform for an XML Document to remove duplicate Nodes. The XML file is as below ... The XSL stylesheet I am using to do this is as below. ... The output generated removes the duplicate node but somehow doesn't process the CDATA sections properly. This is an indication that the XML processor in your XSLT processor is not communicating the correct information to the XPath data model builder ... it is making a text node out of the CDATA markup and it should not be doing so. I have tried adding a "cdata-section-elements" section to the xsl:ouput tag telling it to treat Text.Description & Text.LongDescription as CDATA. This creates the following output Right ... because on the way in it read your CDATA markup as text, not as markup. Your files work just fine with Instant Saxon 6.5.3 (copied below). I hope this helps. ...................... Ken
<Text LineCount="29" Object="RECORD" Status="?" Version="000"> <Text.Description><![CDATA[Table File]]></Text.Description> <Text.LongDescription><![CDATA[Table File]]></Text.LongDescription> </Text> </Test> T:\ftemp>type rohit.xsl <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:template match="Text"> <xsl:if test="not(@Object = preceding::Text/@Object)"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:if> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> T:\ftemp>saxon rohit.xml rohit.xsl <Test> <Text LineCount="29" Object="RECORD" Status="?" Version="000"> <Text.Description>Table File</Text.Description> <Text.LongDescription>Table File</Text.LongDescription> </Text>
<xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> T:\ftemp>saxon rohit.xml rohit2.xsl <Test> <Text LineCount="29" Object="RECORD" Status="?" Version="000"> <Text.Description><![CDATA[Table File]]></Text.Description> <Text.LongDescription><![CDATA[Table File]]></Text.LongDescription> </Text> </Test>
|
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
|