You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/06/03 19:45:01 UTC

DO NOT REPLY [Bug 20456] New: - output-method html;href-attribute: url encoding after utf8-encoding

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20456>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20456

output-method html;href-attribute: url encoding after utf8-encoding

           Summary: output-method html;href-attribute: url encoding after
                    utf8-encoding
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: fischer@seitenbau.de


Context: a stylesheet produces html output in (standard) utf-8-encoding. In the 
output, a hyperlink is build with an <a href="..."> - tag.

Problem: If special characters are used in the href-tag; the output in the href-
attribute is first utf-8-encoded and then url-encoded. This output can not be 
interpreted correctly by a browser.

Excpected behaviour: the encoding should be the other way round, first url-
encoding and then utf-8-encoding. 

Additional comments: The special characters are read in correctly; because 
other attributes than the href-attribute give the expected output. So my guess 
is that the problem lies on the output side.
The problem also occurs with xsltc.

Stylesheets which produce the error:
xml:
<?xml version='1.0' encoding='ISO-8859-1'?>
<content>
  <link>
    <parameter name="umlauttest" value="������" />
  </link>
</content>

xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <xsl:output method="html" indent="no"/>

  <xsl:template match="/content">
    <html>
      <head>
      </head>
      <body>
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="link">
    <a>
      <xsl:attribute name="dummy">
        <xsl:text>test.html?dummy=1</xsl:text>
        <xsl:apply-templates select="parameter" />
      </xsl:attribute>
      <xsl:attribute name="href">
        <xsl:text>test.html?dummy=1</xsl:text>
        <xsl:apply-templates select="parameter" />
      </xsl:attribute>
      <xsl:text>link</xsl:text>
    </a>
  </xsl:template>

  <xsl:template match="parameter">
    <xsl:text>&amp;</xsl:text>
    <xsl:value-of select="@name" />
    <xsl:text>=</xsl:text>
    <xsl:value-of select="@value" />
  </xsl:template>

</xsl:stylesheet>

output:
(Note: the attribute"dummy" appears as expected; the attribute"href" is not 
treated correctly)
<html xmlns:fo="http://www.w3.org/1999/XSL/Format"><head><META http-
equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>
  <a dummy="test.html?
dummy=1&amp;umlauttest=&Auml;&auml;&Ouml;&ouml;&Uuml;&uuml;" href="test.html?
dummy=1&umlauttest=%C3%84%C3%A4%C3%96%C3%B6%C3%9C%C3%BC">link</a>
</body></html>

EXPECTED output: something like
... href="test.html?dummy=1&umlauttest=%C4%E4%D6%F6%DC%FC"> ...
(after the urlEncoding, the utf-8-encoding does nothing)