XML Schema and CDATA

This should cover W3C XML Schema, Relax NG and DTD related problems.
miami
Posts: 3
Joined: Mon Jul 04, 2005 6:46 pm

XML Schema and CDATA

Post by miami »

Hi a newbie question I hope someone can help!

I'm working with the following Data:

<record>
<title><![CDATA[A Game Title]]></title>
</record>

I have created a schema file for the xml and a stylesheet for users to edit the data.

Unfortunately the text between the ![CDATA[...]] tags is not showing up in the stylesheet. Taking the CDATA tags out of the xml is not an option.

I think the problem is in the schema rather than the xsl. Has anyone any ideas how I can fix this problem?

Cheers
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

The XSL data model does not contain CDATA, the XSLT processor will see no difference when you pass it as input the follosing XML:

Code: Select all


<record>
<title>A Game Title</title>
</record>
That is the XSLT procesor will see a text node there. CDATA is only a syntax feature that allows you to write some special characters unescaped, for instance you can write < inside a CDATA section while outside of it you need to escape it as <

Best Regards,
George
miami
Posts: 3
Joined: Mon Jul 04, 2005 6:46 pm

Post by miami »

Hi,

I should really have been more specific in my original post, I'm using XMLSpy and Altova Authentic to view the completed style sheets. The content appears in the HTML view but not in the Authentic view which is what I need to use.

If the xsl doesn't see the CDATA tags why does the content within these tags not show up?

I'm now attempting to try to edit the xsl:output directive to see if this will force the content to show. :?

Thanx

M
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Maybe you should try then asking on the support channels for that product, we are not familiar with that so I cannot imagine how it deals with CDATA sections.

Good luck :wink: !

George
miami
Posts: 3
Joined: Mon Jul 04, 2005 6:46 pm

Post by miami »

Will do!

Thanks for your help :)
Post Reply