Subject:how to print only cdata value/contents Author:Chris Butler Date:26 Aug 2007 12:54 AM Originally Posted: 25 Aug 2007 02:15 PM
Hi and thanks so much for this forum.
I am a web developer starting to get my feet wet re: xslt. I am working on a project which involves receiving a feed over which I have no control, formed like so:
... (copied from html source-not sure if the char entities are in the actual feed?) output to an html table via an xslt transformation accomplished via PHP's transformToURI():
I more or less have all the above working fine... my problem is that no matter what I do, "<![CDATA" and "]]>" are being printed in my table. I can find loads of info on how to transform to include these (are they known as?) tags, but nothing anywhere re: how NOT to print them... in fact, to all indications, they should simply be ignored in their output context. I have attached the xsl file, will be happy to supply any other code per your request.
Subject:how to print only cdata value/contents Author:Jamil Taylor Date:26 Aug 2007 08:42 AM
Your XML contains the data that is appearing, so it's doing exactly what you are telling it to. If you want to remove the <![CDATA[ and ]]> from the text, you can do it two different ways depending on whether you're using XSLT 1.0 or 2.0.
If you're using 2.0, simply use nested replace functions:
Subject:how to print only cdata value/contents Author:Chris Butler Date:26 Aug 2007 12:40 PM
Jamil, thanks very much for your reply.
I am using 1.0-so far, I can't find anything on any string replacement functionality for 1.0-any possibility you could point me in the right direction?
Also, I think I am not understanding some fundamental things re: output... on this w3c pg:
... re: xslt it says "The html output method should not perform escaping for the content of the script and style elements. For example, a literal result element written in the stylesheet as