xsl-list
[Top] [All Lists]

RE: [xsl] problem with processing CDATA tags in xml

2010-04-08 06:58:58
Ok....

I need to clarify one thing...

Their product schema does not allow a <Value> to have subtags... That's why 
they use CDATA.  And in my opinion that's not so bad since from a data point of 
view these html tags are pure a rendition thing.

But basically I see 2 options from the responses:

(1): Use cdata-sections attribute  on <xsl:output> 
(2): make changes to the schema for all elements which may have html tags as 
children


I still see a problem with (1)... in the end when serializing to html I still 
want to disable-output-escaping so the browser will recognize <sub> and <sup> 
as tags instead of plain text... but then the greater then '>' will result in 
invalid xml.  

And I'm not sure if (2) will be accepted since this will involve quite a bit of 
work to implement the changes.

Kind regards,
Robby




-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Thursday, April 08, 2010 1:44 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] problem with processing CDATA tags in xml

I have a problem processing following tag:

The original tag before transformation was:
<Value><![CDATA[G<sub>p(max)</sub> is the maximum power gain, 
if K > 1. If K < 1 then G<sub>p(max</sub> = MSG.]]></Value>


My customer wants to use <sub> and <sup> tags so in the 
rendition it's formatted nicely.


An excellent idea. If you want <sub> and <sup> to be recognized as tags, all
they need to do is get rid of the CDATA:

<Value>G<sub>p(max)</sub> is the maximum power gain, 
  if K > 1. If K &lt; 1 then G<sub>p(max</sub> = MSG.</Value>

The only possible reason for having the CDATA is to prevent the <sub> and
<sup> being recognized as tags, so if you want them treated as tags, just
cut out the CDATA.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--