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=20841>.
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=20841

linefeed character not handle properly on Windows.

           Summary: linefeed character not handle properly on Windows.
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.templates
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


xsl:attribute with value contains "&#10;" will be convert to "0x0d 0x0d 0x0a" 
when using with HTML output format.

My investigation shown that, in ElemAttribute.constructNode(), Xalan use:
        String val = transformer.transformToString(this);
which will use the SerializerToText to contruct the attribute value (and 
within this text serializer, 0x0a will be convert to the pair (0x0d,0x0a) on 
windows), and then in the "html output" phase, the SerializerToHTML will again 
convert it to (0x0d,0x0d,0x0a).

After discussing with various Xalan developer, seems like we should not use 
the text serializer to construct element node and attribute value.

XML Testcase:
<?xml version="1.0" encoding="UTF-8"?>
<root><env><param name="f1">aaa&#10;bbb</param></env></root>

XSLT Testcase:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
  <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  <xsl:template match="/root">
    <x name="f1">
      <xsl:attribute name="value"><xsl:value-of select="env/param
[EMAIL PROTECTED]'f1']"/></xsl:attribute>
    </x>
  </xsl:template>
</xsl:stylesheet>

Reply via email to