MM, thanks for tackling this old tedious topic.
Yes, we do have control over the XML content as it is generated from within applications with a UI we have built ourselves with Revolution. And I can do anything with the data as it is written out to XML... i.e. we can easily "poke" the CDATA section by doing an SnR to replace "cr" -- char(10) -- with "</p>&cr&<p>" in my code...
But, while a simple solution, it's not working, I did a manual entry to the CDATA section and, at least in Fire Fox, we still seeing those strings passed as literals to the screen:
as you can see at:
http://himalayanacademy.co
But, yes, let's not be stuck in a box....... I like "other avenues" ... [disclaimer: I'm and XML XSLT infant who doesn't know anything more than what he learned at w3Schools.org, so feel free to tell me anything you want. ]
So how about this... for simple textual data (articles in magazines, transcripts of audio discourses, lectures etc.) Do we really need to use CDATA? I just did that to be "safe" but if the only chars that are a problem are > and & then may I should
a) not use CDATA but just let the content be standard PCDATA as in
<transcript_text>
Conditions in the world today are certainly troubling
New 2nd paragraph... The shocking attacks in New York on September 11, 2001,
3rd paragraph... One of the immediate consequences of 9/11 was the television coverage etc.
</transcript_text>
b) have our input app UI simply escape illegal chars ">" and "&" (I keep telling data entry people don't use Ampersands, but invariably some one will enter "apples & oranges")
c) then we tackle the mark up issue with the XSL some other way... ? --0 especially since your proposed solution didn't work
This has advantages because the data in the main content section (s) which has paragraph breaks, may be repurposed into a other environments and I would rather not have to enter html mark up into the XML unless absolutely necessary. Which is after all "forbotten!" in the XML --> XHMTL paradigm anyway ... not that I'm stuck on such so called principles, but it's relevant here...
TIA
Sivakatirswami
Main Topics
Browse All Topics





by: metalmickeyPosted on 2005-06-10 at 13:28:37ID: 14192351
I think that your CDATA section is what is causing the problem, since cdata sections are a specific instruction the processor NOT to process anything between the open and close <![CDATA[ tags ]]>.
nditions in the world today are certainly troubling,</p>
w 2nd paragraph... The shocking attacks in New York on September 11, 2001,</p>
d paragraph... One of the immediate consequences of 9/11 was the television coverage etc.</p>
;Condition s in the world today are certainly troubling,>/p<
you could use this facet of cdata to your advantage by passing in html markup...
<transcript_text>
<![CDATA[
<p class="transcript_text">Co
<p class="transcript_text">Ne
<p class="transcript_text">3r
]]>
</transcript_text>
since your parser isnt reading this part of the page, your tags wont be escaped once parsed.
>p class="transcript_text"<
Your browser is then free to read the html markup within.
This does assume that you have some control over the xml content...but having said that you'd have probably marked the xml up accordingly.
This may not have answered your Q but may have opened up an avenue to explore.
MM