[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] character entity references; saxon ie 6.0 differences


Subject: RE: [xsl] character entity references; saxon ie 6.0 differences
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 26 Aug 2003 19:02:54 +0100

> Why when I translate with saxon is the &eacute; not getting 
> translated to &#x000E9; and remains &eacute;? I also noticed 
> that the following entities: &dagger;, &diams;, &bull; are 
> translated by saxon to &#8224;, &#9830;, &#8226; respectively 
> when my character mapping is &#x2020;, &#x2666;, &#x2022;?

You can find information about how Saxon serializes characters, and how
you can influence it, at
http://saxon.sourceforge.net/saxon7.6.5/extensions.html#output

The entities and numeric character references in the source document are
translated by the XML parser into regular characters. Saxon isn't told
whether the character was represented originally as itself, as a decimal
character reference, a hex character reference, or whatever. On
serialization, Saxon has to choose a representation suitable to the
output encoding. It prefers decimal representation to hex, but you can
configure this if you want. What you can't do is to say "use the same
representation as was used in the input", because Saxon doesn't know
that.

Michael Kay


> 
> Dan
> 
> -----Original Message-----
> From: Whitney, Dan (CanWest Interactive) [mailto:DWhitney@xxxxxxxxxxx]
> Sent: August 26, 2003 1:19 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE: [xsl] character entity references; saxon ie 6.0 
> differences
> 
> 
> Brook,
> Sorry, I guess I should have specified I have the entity defined as 
> <!ENTITY eacute           "&#x000E9;" ><!--=small e, acute accent -->
> in external files (along with most of the other possible 
> entities) which are included in the doctype declaration.
> 
> Dan
> 
> -----Original Message-----
> From: Brook Ellingwood [mailto:brook@xxxxxxxxxxx]
> Sent: August 26, 2003 12:59 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Re: 
> 
> 
> Dan,
> 
> You can't use an HTML entity in XML. You should use the 
> equivalent entity from the UTF-16 character set. This URL is 
> convenient for finding the common character codes: 
> http://www.hclrss.demon.co.uk/demos/ansi.html
> 
> This URL has far greater scope if you ever need to find a 
> less common code: http://www.alanwood.net/unicode/search.html
> 
> In theory, if you are using a Unicode-aware text editor, you 
> can set the encoding of your file to UTF-16 (or UTF-8) and 
> just type the characters in without using the entities, but 
> I've had pretty lousy luck getting that to work all the way 
> to the browser. For now, you're safer to use the entities.
> 
> -- Brook
> 
> -----Original Message-----
> From: Whitney, Dan (CanWest Interactive) [mailto:DWhitney@xxxxxxxxxxx]
> Sent: August 26, 2003 1:00 PM
> To: 'mulberry - xsl'
> Subject: [xsl] character entity references; saxon ie 6.0 differences
> 
> 
> Sorry forgot to add a subject to my intial post.
> 
> I have the following XML fragment:
> 
> <RECORDITEM sqlsource="cityprov" 
> colname="col4">Montr&eacute;al, 
> QC<RECORDREF>specialannual</RECORDREF></RECORDITEM>
> 
> I want my output to be:
> 
> <td>Montr&eacute;al</td><td>specialannual</td>
> My xsl is:
>         <xsl:for-each select="RECORDITEM">
>           <td align="right">
>             <font face="verdana" size="1">
>             <xsl:value-of select="text()"/>
>             </font>
>           </td>
>           <td align="right">
>             <font face="verdana" size="1">
>             <xsl:value-of select="RECORDREF"/>
>             </font>
>           </td>
>         </xsl:for-each>
> When I use ie 6.0 to open this the entity "&eacute;" is not 
> interpreted as text? so I get something like the following: 
> <td align="right>Montr</td><td 
> align="right">specialannual</td> When I translate it with 
> saxon everything comes out as I want. Which is correct and 
> can I write my XSL to overcome the discrepancy?
> 
> 
> Thanks in advance,
> 
> Dan Whitney
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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



Current Thread
Keywords