W3C home > Mailing lists > Public > xsl-editors@w3.org > October to December 2000

Using 'xsl:output' for including CDATA tags

From: Orit Shchori <orit@ibotsoft.com>
Date: Wed, 29 Nov 2000 12:45:01 +0200
Message-ID: <009901c059f1$6cf5eaa0$1201a8c0@ibotorit>
To: <xsl-editors@w3.org>
Hello.
I am really desperate about this subject. I tried to ask it in few forums and nobody knew to answer me. 
I will be really greatful, if you can help me.
When I try to convert this "foo.xml":

*************************
* <?xml version="1.0"?>
* <foo>                
* <doc1>Hello1</doc1>  
* <doc2>Hello2</doc2>  
* <doc3>Hello3</doc3>  
* </foo>               
*************************

with this "fooToRes.xsl":

***********************************************************************************
* <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
*                                                                                
* <xsl:output cdata-section-elements="out3"/>                                    
*                                                                                 
* <xsl:template match="/">                                                       
* <out>                                                                           
* <out1>
* <xsl:value-of select=".//foo/doc1"/>
* </out1>              
* <out2>
* <xsl:value-of select=".//foo/doc2"/>
* </out2>
* <out3>                 
* <xsl:value-of select=".//foo/doc3"/>
* </out3>
* </out>
* </xsl:template>          
* <xsl:template match="text()|@*"/>
*                                                           
* </xsl:stylesheet>
***********************************************************************************

I get this result with xt: (it ignores the CDATA)

*************************
* <out>                
*   <out1>Hello1</out1>
*   <out2>Hello2</out2>
*   <out3>Hello3</out3>
* </out>               
*************************

this result with the Xalan: (all the elements get the CDATA)

*************************************
* <out>                            
*   <out1><![CDATA[Hello1]]></out1>
*   <out2><![CDATA[Hello2]]></out2>
*   <out3><![CDATA[Hello3]]></out3>
* </out>                           
*************************************

and this result in the IBM XSL Editor: (the correct element gets the CDATA)

*************************************
* <out>                            
*   <out1>Hello1</out1>            
*   <out2>Hello2</out2>            
*   <out3><![CDATA[Hello3]]></out3>
* </out>                           
*************************************
 
Why is it different in each transformation? Which is the correct answer? And how can I get the correct answer in the other XSL Transformations?
And another question - is there a way to use the FULL PATH of the element in the 'cdata-section-elements' attribute of the 'xsl:output'  ?
Thank you very much, 
 
Orit Shchori
ibot
orit@ibotsoft.com

 
Received on Wednesday, 29 November 2000 05:43:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:51 GMT