xsl-list
[Top] [All Lists]

Re: [xsl] xslt breaks css with a <![CDATA[ <img/> ]]> tag!

2006-09-09 15:02:40

Remember that XSLT has no connection with CSS (or HTML or javascript or
anything else used to render the page in the browser). The XSLT engine,
whether iy is running on the server runs before the rendered document is
processed by the page layout engine and that just renders what is there.


  <element><![CDATA[Name2 <img
src="http://www.google.com/images/logo_sm.gif"; height="20px" />
Name]]></element>


If you have any control over your input it would be much better to have

  <element>
src="http://www.google.com/images/logo_sm.gif"; height="20px" />
</element>

as the _only_ purpose f CDATA is to inform the processor that the
<img is_not_ a tag, when clearly you want it to be processed as a tag.

     <div class="box"><xsl:value-of select="element"
  disable-output-escaping="yes"/></div>

d-o-e is explictly an optional feature of xslt and a processor can
igonre it. In particular most processors can not support it if they are
outputting a result tree as a tree ratherthan a linearised document, as
then the output escaping (if it ever happens at all is under the control
f whatever application uses the tree. One notable system that always
outputs as a DOM tree is the one in mozilla.

Well, what makes it all the more interesting is if you remove
the <img/> tag from the CDATA, oh look! it works like it
should!!

If you rephrase that more acurately as "if you have an image tag rather
tahn the character data < i m g then it includes an inage as expected.

David


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>