Re: [xsl] cdata output and different xslt processors

Subject: Re: [xsl] cdata output and different xslt processors
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 29 Oct 2001 00:14:34 GMT

   I have been porting my presentation layer to use different backend
   processors.  So far using saxon-java has been the easiest except for it's
   handling of cdata.  I was wondering if the was a standard way of handling
   it, specifically "<" and ">"?

   To me, it would seem that the xslt processor should supply the markup
   without escaping it. I have seen a response on this from Mike Kay in a post
   on Oct 2000 saying:

   "Because the angle brackets are in a CDATA section, they are ordinary
   characters, not markup, so they have to be output as ordinary characters."

   My understanding is that whatever is between cdata brackets should be passed
   "as-is". Wouldn't this be easiest for people to understand?  I realize there
   must be some reason for Saxon not doing this. What is it? WHy do the other
   processors I have used not do this?


To any XSLT system (and any XML application) input of
<![CDATA[<aaa>]]> should be the same as input of &lt;aaa&gt;
an XSLT system just can't tell which form the source file had.
That is the whole point of CDATAS marked sections it's a convenience
feature for an author to save quoting each < and & individually
but the whole point is taht it should be equivalent to the quoted form.






   In a situation I have the workaround (xsl:text
   disable-out-put-escaping="yes") is ugly and does not produce the same
   results as cdata (that does not escape "<" or ">"). I have to (???) use
   cdata because i am trying to output some non-standard browser stuff, here is
   a snippet using xsl:text:

Why are you outputting this as text rather than as an element with
 attributes????????? 

   <xsl:text disable-output-escaping="yes">

      &lt;DIV STYLE="position:absolute; padding:5px; background:menu;
   border:2px outset #cccccc;"&gt;

	 &lt;myMenu:menu id="Site" onsubmenu_click="doFunction()" &gt;Site
	   &lt;myMenu:menu id="mnItem_GenSite"&gt;Generate
   Site&lt;/myMenu:menu&gt;
	    &lt;myMenu:menu id="mnItem_PromoteSite"&gt;Promote
   Site&lt;/myMenu:menu&gt;
	   &lt;myMenu:menu
   id="mnItem_EditProps_Site"&gt;Properties&lt;/myMenu:menu&gt;
	    &lt;myMenu:menu id="mnItem_SiteMap"&gt;View
   Sitemap&lt;/myMenu:menu&gt;
	    &lt;myMenu:menu id="mnItem_New_Site"&gt;Edit Another
   Site&lt;/myMenu:menu&gt;
	 &lt;/myMenu:menu&gt;

   ....snip.....


maybe the answer to my question above is in the paragraph below, but
if so I don't understand. Given that your stylesheet is using the myMenu
namespace why do you want to avoid declaring it?

   Is there another way I can handle this?  I don't want to declare the
   namespace for the transformation on the server. I want it to be used only on
   the client.

   thanks for any help/insight,
   -Rob



David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread