Re: [xsl] Preseving character entities

Subject: Re: [xsl] Preseving character entities
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 29 Nov 2004 16:34:49 GMT
  Why can't CDATA entities be used for this? These are allowed in both
  XML and SGML. 


No. XML doesn't have CDATA entities either, it just has general internal
entities that could contain markup but just happen not to have eny
markup in the case of those particular definitions.


  That is what I meant to ask (first line of this message). How else are
  XHTML entities/named characters defined in all those XHTML DTD's of
  W3C?


  You mean, the named character references (entities) are resolved to predefined unicode characters, 
  just as if one were reading XHTML with an XML parser using an XHTML DTD which defines these entities 
  as such. It could be that browsers resolve the entities _after_ reading the data (contrary to XML 
  Parsers usually do), but then again, I'm not a browser expert. They _could_ do it just like XML 
  Parsers...

historically SDATA entities would _never_ be resolved to unicode
characters, the application would just fetch an alpha (or whatever)
using some internal encoding mapping to some greek font which may well
have an alpha in the position taken by "a" in a latin font for example.
These days they may or may not go via a unicode table.

When I mentioned that in entity and XML entity and character references
are expanded at different times, I meant that they are expanded at
different times within the XML parser, given

<!ENTITY myalpha-1 "&#945;">
<!ENTITY myalpha-2 "&alpha;">

the replacement text for myalpha-1 is the unicode character  945 (not the
character reference &#945; as character references are always expanded
when first encountered.

conversely the replacement text for myalpha-2 is an entity reference to
an entity named alpha (which will have the same definition as myalpha-1
if any of the usual entity sets has been referenced), but note that
&alpha; here isn't expanded (and doesn't even need to be defined)
at the point that myalpha-2 is defined.



  To put your words into mine: I am substituting a confusing but
  'correct' terminology by a clearer but incorrect terminology. I got
  your point, but am still not more convinced than before... 

except that I can prove that at least one person is confused by your
"clearer" terminology. Given a question about generating entity
references I gave an answer about generating entity references, assuming
that what was meant was entity reference. Since the original terminoligy
was a bit mixed, you'll see that I did query whether character
references were the intended meaning, but I made the wrong guess and
answered assuming that entity references were required.


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