You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthieu Benéteau <m....@quaternove.fr> on 2002/03/18 10:51:38 UTC

Different behaviours of HTMLSerializer, in attributes and elements.

Hi,

I have a little problem with the HTMLSerializer and accented letters in
French.
I'm working with Cocoon 2.0.1.
All my XML files and stylesheets and all my components use the iso-8859-1
encoding.


In my XML file I have the following element, which has an &eacute; letter in
attribute "nom" :

<dimensionPhysique nom='puissance réelle' indexDimension='9'/>


This element is correctly processed by a stylesheet to give the following
XHTML :

<a name="puissance réelle"></a>
<table>
  <tr>
    <td bgcolor="#EEDDEE">
      <b>Dimension name :</b>
      puissance réelle
      <br/>
      <b>Dimension index :</b>
      9
    </td>
  </tr>
  ...
</table>

So now the accented letter appears twice : once in the "name" attribute of
an anchor, and once in the content of a table row. No problem here.


The problem appears after serialization with the HTMLSerializer, which gives
the following HTML :

<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
...
<a name="puissance r%C3%A9elle"></a>
<table>
  <tr>
    <td bgcolor="#EEDDEE">
      <b>Dimension name : </b>
      puissance r&eacute;elle
      <br/>
      <b>Dimension index : </b>
      9
    </td>
  </tr>
  ...
</table>

In the "name" atribute of the anchor, the &eacute; letter has been replaced
by %C3%A9, so the following instruction will fail :
parent.centerFrame.location.hash='#puissance r&eacute;elle';


IMHO, this is not a correct behaviour of the HTMLSerializer.
Am I right ?


Matthieu




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Different behaviours of HTMLSerializer, in attributes and elements.

Posted by Matthieu Benéteau <m....@quaternove.fr>.
No, the problem is not there : this script line is generated automatically
and correctly by the stylesheet. It generates the character itself :

parent.centerFrame.location.hash='#puissance réelle';

and the character is then correctly replaced by "&eacute;" by the
HTMLSerializer.


The problem is that this character is replaced by "%C3%A9" (instead of
"&eacute;") when it is inside the "name" attribute of an anchor. Is this a
correct behaviour ?


Matthieu


> -----Message d'origine-----
> De : KOZLOV Roman [mailto:r-kozlov@opencascade.com]
> Envoyé : lundi 18 mars 2002 12:36
> Cc : Cocoon-Users
> Objet : Re: Different behaviours of HTMLSerializer, in attributes and
> elements.
>
>
> Hello,
>
> IMHO, in the script line you have to put the character itself and
> not "&eacute;"
> because such an entity will not be substituted. So try the following:
>
> parent.centerFrame.location.hash='#puissance réelle';
>
> PS: I've not checked if the "%C3%A9" in an element's name will be
> translated by
> script interpreter (and I don't know exactly a kind of
> interpreter you use) so
> perhaps you need xsl:attribute element with CDATA section in your
> XML source.
>
> Best regards
>     Roman
>
> Matthieu Benéteau wrote:
>
> > Hi,
> >
> > I have a little problem with the HTMLSerializer and accented letters in
> > French.
> > I'm working with Cocoon 2.0.1.
> > All my XML files and stylesheets and all my components use the
> iso-8859-1
> > encoding.
> >
> > In my XML file I have the following element, which has an
> &eacute; letter in
> > attribute "nom" :
> >
> > <dimensionPhysique nom='puissance réelle' indexDimension='9'/>
> >
> > This element is correctly processed by a stylesheet to give the
> following
> > XHTML :
> >
> > <a name="puissance réelle"></a>
> > <table>
> >   <tr>
> >     <td bgcolor="#EEDDEE">
> >       <b>Dimension name :</b>
> >       puissance réelle
> >       <br/>
> >       <b>Dimension index :</b>
> >       9
> >     </td>
> >   </tr>
> >   ...
> > </table>
> >
> > So now the accented letter appears twice : once in the "name"
> attribute of
> > an anchor, and once in the content of a table row. No problem here.
> >
> > The problem appears after serialization with the
> HTMLSerializer, which gives
> > the following HTML :
> >
> > <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > ...
> > <a name="puissance r%C3%A9elle"></a>
> > <table>
> >   <tr>
> >     <td bgcolor="#EEDDEE">
> >       <b>Dimension name : </b>
> >       puissance r&eacute;elle
> >       <br/>
> >       <b>Dimension index : </b>
> >       9
> >     </td>
> >   </tr>
> >   ...
> > </table>
> >
> > In the "name" atribute of the anchor, the &eacute; letter has
> been replaced
> > by %C3%A9, so the following instruction will fail :
> > parent.centerFrame.location.hash='#puissance r&eacute;elle';
> >
> > IMHO, this is not a correct behaviour of the HTMLSerializer.
> > Am I right ?
> >
> > Matthieu
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Different behaviours of HTMLSerializer, in attributes and elements.

Posted by KOZLOV Roman <r-...@opencascade.com>.
Hello,

IMHO, in the script line you have to put the character itself and not "&eacute;"
because such an entity will not be substituted. So try the following:

parent.centerFrame.location.hash='#puissance réelle';

PS: I've not checked if the "%C3%A9" in an element's name will be translated by
script interpreter (and I don't know exactly a kind of interpreter you use) so
perhaps you need xsl:attribute element with CDATA section in your XML source.

Best regards
    Roman

Matthieu Benéteau wrote:

> Hi,
>
> I have a little problem with the HTMLSerializer and accented letters in
> French.
> I'm working with Cocoon 2.0.1.
> All my XML files and stylesheets and all my components use the iso-8859-1
> encoding.
>
> In my XML file I have the following element, which has an &eacute; letter in
> attribute "nom" :
>
> <dimensionPhysique nom='puissance réelle' indexDimension='9'/>
>
> This element is correctly processed by a stylesheet to give the following
> XHTML :
>
> <a name="puissance réelle"></a>
> <table>
>   <tr>
>     <td bgcolor="#EEDDEE">
>       <b>Dimension name :</b>
>       puissance réelle
>       <br/>
>       <b>Dimension index :</b>
>       9
>     </td>
>   </tr>
>   ...
> </table>
>
> So now the accented letter appears twice : once in the "name" attribute of
> an anchor, and once in the content of a table row. No problem here.
>
> The problem appears after serialization with the HTMLSerializer, which gives
> the following HTML :
>
> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> ...
> <a name="puissance r%C3%A9elle"></a>
> <table>
>   <tr>
>     <td bgcolor="#EEDDEE">
>       <b>Dimension name : </b>
>       puissance r&eacute;elle
>       <br/>
>       <b>Dimension index : </b>
>       9
>     </td>
>   </tr>
>   ...
> </table>
>
> In the "name" atribute of the anchor, the &eacute; letter has been replaced
> by %C3%A9, so the following instruction will fail :
> parent.centerFrame.location.hash='#puissance r&eacute;elle';
>
> IMHO, this is not a correct behaviour of the HTMLSerializer.
> Am I right ?
>
> Matthieu
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>

RE: Different behaviours of HTMLSerializer, in attributes and elements.

Posted by Matthieu Beneteau <m....@quaternove.fr>.
With the XML serializer, the result is just what I expected, the character
isn't replaced :

<?xml version="1.0" encoding="iso-8859-1"?>
...
<a name="puissance reelle"/>
<table>
  <tr>
    <td bgcolor="#EEDDEE">
      <b> Dimension name : </b>
      puissance reelle
      <br/>
      <b> Dimension index : </b>
      9
    </td>
  </td>
</table>
...
parent.centerFrame.location.hash='#puissance reelle';

In this case the accented character is treated the same way inside an
attribute or inside the body of an element.


With an HTML serializer, I expect this character to be replaced by
"&eacute;".

Any idea, Vadim ?


Matthieu



> -----Message d'origine-----
> De : Vadim Gritsenko
> [mailto:vadim.gritsenko@verizon.netm.beneteau@quaternove.fr]
> Envoye : lundi 18 mars 2002 14:33
> Objet : RE: Different behaviours of HTMLSerializer, in attributes
> and elements.
>
>
> > From: Matthieu Benйteau [mailto:m.beneteau@quaternove.fr]
> >
> > Hi,
>
> <snip/>
>
> > ...
> > <a name="puissance r%C3%A9elle"></a>
> > <table>
> >   <tr>
> >     <td bgcolor="#EEDDEE">
> >       <b>Dimension name : </b>
> >       puissance r&eacute;elle
> >       <br/>
> >       <b>Dimension index : </b>
> >       9
> >     </td>
> >   </tr>
> >   ...
> > </table>
> >
> > In the "name" atribute of the anchor, the &eacute; letter has been
> replaced
> > by %C3%A9, so the following instruction will fail :
> > parent.centerFrame.location.hash='#puissance r&eacute;elle';
> >
> >
> > IMHO, this is not a correct behaviour of the HTMLSerializer.
> > Am I right ?
>
> What the result with the XML serializer?
>
> Vadim
>
> >
> > Matthieu
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Different behaviours of HTMLSerializer, in attributes and elements.

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Matthieu Benйteau [mailto:m.beneteau@quaternove.fr]
> 
> Hi,

<snip/>
 
> ...
> <a name="puissance r%C3%A9elle"></a>
> <table>
>   <tr>
>     <td bgcolor="#EEDDEE">
>       <b>Dimension name : </b>
>       puissance r&eacute;elle
>       <br/>
>       <b>Dimension index : </b>
>       9
>     </td>
>   </tr>
>   ...
> </table>
> 
> In the "name" atribute of the anchor, the &eacute; letter has been
replaced
> by %C3%A9, so the following instruction will fail :
> parent.centerFrame.location.hash='#puissance r&eacute;elle';
> 
> 
> IMHO, this is not a correct behaviour of the HTMLSerializer.
> Am I right ?

What the result with the XML serializer?

Vadim

> 
> Matthieu
> 


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>