You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2005/09/22 12:52:34 UTC

Omitting €

Hi,

I am using Xalan with the output method "html". The generated HTML 
contains the entity reference

     &euro;

Unfortunately, I have a legacy application, which doesn't support this 
entity. Numeric entity references would be fine, though. Is it possible, 
to tell Xalan, that it should emit only numeric character references?

Regards,

Jochen


Re: Omitting €

Posted by Sonja Löhr <so...@arcor.de>.
Sorry, stanimir, did I post to your personal address?
I thought replies would automatically be routed to the group?

sonja


Am Donnerstag, den 22.09.2005, 20:15 +0300 schrieb Stanimir Stamenkov:
> /Sonja Löhr/:
> > Am Donnerstag, den 22.09.2005, 15:04 +0300 schrieb Stanimir Stamenkov:
> >
> >> <http://xml.apache.org/xalan-j/usagepatterns.html#outputprops> 
> >
> > Isn't there any class one could extend to influence escaping, perhaps 
> > some XyzResolver ?
> > I always have trouble with decimal entities in the source xml, since in 
> > the output I have things like
> >  &amp;#252;
> 
> What kind of troubles? Did you mean &#252; above? It shouldn't 
> matter whether the character reference code is in decimal or 
> hexadecimal form. AFAIK older processors (mostly Web browsers) could 
> have troubles interpreting the hexadecimal form which I guess is the 
> reason for the Xalan developers to choose the default decimal form.
> 
> > I already wrote NoEscapeXYZ classes for jdom XMLOutputter and 
> > commons.betwix.Beanwriter, for xalan there is no such possibility?
> 
> I don't know if there's property to configure character references 
> to be written in hexadecimal form. I haven't tried but I guess one 
> could configure an "entities" file where instead of general entity 
> names, the keys are the hexadecimal form of the character reference, 
> like:
> 
> #x20AC=8364
> 
> But filling an entry for every single code would be too inefficient.
> 
-- 
Sonja Löhr <so...@arcor.de>


Re: Omitting €

Posted by Sonja Löhr <so...@arcor.de>.
I'm SO sorry to have stolen your time !!! 
I was totally wrong, it is NOT xalan that escapes the ampersand, it is
only the XML-generating apis.

Sorry again!
sonja


> > No, the INPUT is &#252; and I like to have it in the output, too, but 
> > the output is &amp;#252;
> > I only use decimal character references, but they are never recognized 
> > as such but always the ampersand gets escaped :-(
> > 
> > That is, I don't want xalan to introduce character references (I mean, 
> > it may do so) but it shall just leave the existing ones as they are.
> 
> Xalan doesn't introduce character references in the sense you point 
> above. The case you describe seems like escaping the '&' symbol from 
> the input character data, but then it is part of the character data 
> and not part of the markup. Could you give an example input?
> 
-- 
Sonja Löhr <so...@arcor.de>


Re: Omitting €

Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/Sonja Löhr/:
> Am Donnerstag, den 22.09.2005, 20:15 +0300 schrieb Stanimir Stamenkov:
>> /Sonja Löhr/:
>> 
>>> Isn't there any class one could extend to influence escaping, perhaps 
>>> some XyzResolver ?
>>> I always have trouble with decimal entities in the source xml, since in 
>>> the output I have things like
>>>  &amp;#252;
>>
>> What kind of troubles? Did you mean &#252; above?
> 
> No, the INPUT is &#252; and I like to have it in the output, too, but 
> the output is &amp;#252;
> I only use decimal character references, but they are never recognized 
> as such but always the ampersand gets escaped :-(
> 
> That is, I don't want xalan to introduce character references (I mean, 
> it may do so) but it shall just leave the existing ones as they are.

Xalan doesn't introduce character references in the sense you point 
above. The case you describe seems like escaping the '&' symbol from 
the input character data, but then it is part of the character data 
and not part of the markup. Could you give an example input?

-- 
Stanimir

Re: Omitting €

Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/Sonja Löhr/:
> Am Donnerstag, den 22.09.2005, 15:04 +0300 schrieb Stanimir Stamenkov:
>
>> <http://xml.apache.org/xalan-j/usagepatterns.html#outputprops> 
>
> Isn't there any class one could extend to influence escaping, perhaps 
> some XyzResolver ?
> I always have trouble with decimal entities in the source xml, since in 
> the output I have things like
>  &amp;#252;

What kind of troubles? Did you mean &#252; above? It shouldn't 
matter whether the character reference code is in decimal or 
hexadecimal form. AFAIK older processors (mostly Web browsers) could 
have troubles interpreting the hexadecimal form which I guess is the 
reason for the Xalan developers to choose the default decimal form.

> I already wrote NoEscapeXYZ classes for jdom XMLOutputter and 
> commons.betwix.Beanwriter, for xalan there is no such possibility?

I don't know if there's property to configure character references 
to be written in hexadecimal form. I haven't tried but I guess one 
could configure an "entities" file where instead of general entity 
names, the keys are the hexadecimal form of the character reference, 
like:

#x20AC=8364

But filling an entry for every single code would be too inefficient.

-- 
Stanimir

Re: Omitting €

Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/Jochen Wiedmann/:

> I am using Xalan with the output method "html". The generated HTML 
> contains the entity reference
> 
>     &euro;
> 
> Unfortunately, I have a legacy application, which doesn't support this 
> entity. Numeric entity references would be fine, though. Is it possible, 
> to tell Xalan, that it should emit only numeric character references?

You probably need to configure the "xalan:entities" output property 
to point to your custom entities configuration file, 
<http://xml.apache.org/xalan-j/usagepatterns.html#outputprops> 
(little down below).

-- 
Stanimir