[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: disable-output-escaping don't work with CDATA spl

Subject: Re: disable-output-escaping don't work with CDATA spl chars (XSL)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 29 Mar 2005 17:45:55 +0100
disable output escaping
Ah now your input got through!


  <AccomUnitName
  StrippedName="aparthotel_g__246_tzens"><![CDATA[Aparthotel
  G&#246;tzens]]></AccomUnitName> 


that wasn't how it appeared the first time (the character was there
directly not the character reference)


that is very strange input, CDATA only has one function, to say that <
and & are normal characters within the marked region.

So that is explictly saying that the input is equivaent to   <AccomUnitName
  StrippedName="aparthotel_g__246_tzens">Aparthotel
  G&amp;#246;tzens</AccomUnitName> 

and that the & # 2 4 6 is _not_ a character reference.

XSLT will see identical input from either of the above two forms.
which is almost certainly not the intended unput.

  results in: Aparthotel G&#246;tzens 
  in the javascript array (and so in html) 

  instead of the correct value: Aparthotel Gvtzens

Yes of course, that is the sole function of a CDATA marked section, to
have that effect.


  
  (2) But while generating javascript like:
  
  var accList=new Array(
  <for-each ...> 
  ......
  ><xsl:value-of select="AccomUnitName"
  disable-output-escaping="yes"/>
  ....
  
  </for-each>
  );
  
  The array results like:
  
  var accList=new Array("xyz,123,Aparthotel
  G&#246;tzens");
  

which means that the d-o-e worked, otherwsie it would have come out as

   var accList=new Array("xyz,123,Aparthotel
  G&amp;#246;tzens");
 
If you were generating XHTML that would be the right thing, but in HTML
a script element is a CDATA element (an element category that does not
exist in XML) which means that it works as if an implied CDATA section
is around the content and so within an HTML script element & #246;
does not refer to the character with number 246 but rather to the
6 character & h 2 4 6 ;

If you have any control over the input at all, just not having the CDATA
section there is the correct solution.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.