xsl-list
[Top] [All Lists]

Re: disable-output-escaping don't work with CDATA spl chars (XSL)

2005-03-29 09:45:55

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 Götzens

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
________________________________________________________________________

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