After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 168196 - <a name=""> escaping in HTML output
<a name=""> escaping in HTML output
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-02-22 22:25 UTC by Oleg Paraschenko
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Oleg Paraschenko 2005-02-22 22:25:13 UTC
Applying stylesheet

[code]
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="ascii"/>
        
<xsl:template match="/">
  <html>
    <head/>
    <body>
      <a href="&#x451;" name="&#x451;">&#x451;</a>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>
[/code]

to itself, I get

[result]
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=ascii"></head>
<body><a href="%D1%91" name="&#1105;">&#1105;</a></body>
</html>
[/result]

Problem is that I expect to get name="%D1%91" instead of name="&#1105;".

Reason: according to the section "16.2 HTML Output Method" of the XSLT
specification,

"The html output method should escape non-ASCII characters in URI attribute
values using the method recommended in Section B.2.1 of the HTML 4.0 Recommendation"

and the end of the Section B.2.1 in the HTML Recommendation is:

Note.  The  same conversion based on UTF-8 should be applied to values of the
name attribute for the A element.
Comment 1 Daniel Veillard 2005-02-22 23:15:32 UTC
name is an URI attribute, doesn't sounds normal to me I would expect this
to be a reference for intra document linking, not an URI ? 
You have a pointer for me to check ?

Daniel
Comment 2 Oleg Paraschenko 2005-02-23 19:19:27 UTC
Pointers are:

http://www.w3.org/TR/xslt#section-HTML-Output-Method
http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.2.1

The note on <a name=""> is at the end of the section B.2.1 (second link).

--

> doesn't sounds normal to me

Indeed, initially I also was not sure. But here is yet another example with
intra-linking:

[code]
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="ascii"/>
        
<xsl:template match="/">
  <html>
    <head/>
    <body>
      <a href="#&#x451;">&#x451;</a>
      <p>a lot of text</p>

      <a name="&#x451;"/><h1>&#x451;</h1>
      <p>a lot of text</p>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>
[/code]

It produces following document:

[html]
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=ascii"></head>
<body>
<a href="#%D1%91">&#1105;</a><p>a lot of text</p>
<a name="&#1105;"></a><h1>&#1105;</h1>
<p>a lot of text</p>
</body>
</html>
[/html]

Please note that "a/@name" and the URI part after "#" are different. It might
confuse some HMTL applications. For example, "links" doesn't follow the link
(although "mozilla" and "lynx" are ok).
Comment 3 Daniel Veillard 2005-03-29 20:36:24 UTC
Makes sense, the fix is in libxml2, but I added your test to libxslt
regression tests, this is all commited in CVS.

  thanks a lot,

Daniel
Comment 4 Oleg Paraschenko 2005-05-05 18:02:51 UTC
Thank you for fixing, and excuse me for late closing.