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 2002/02/05 22:14:03 UTC

DO NOT REPLY [Bug 6256] New: - New-line incorrectly generated for XML fragment

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

New-line incorrectly generated for XML fragment

           Summary: New-line incorrectly generated for XML fragment
           Product: XalanJ2
           Version: 2.2.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: pfeiffer@well.com


Xalan is incorrectly generating a new-line before an XML fragment.

I am using the following stylesheet (notice the number 3 at the end of 
the line marked "NOTICE THIS NUMBER").

---------------- BEGIN STYLESHEET ---------------------
<xsl:stylesheet 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0">

<xsl:template name="total-numbers">
   <xsl:param name="list"/>3<!-- NOTICE THIS NUMBER -->
</xsl:template>

<xsl:template match="/">
   <xsl:call-template name="total-numbers">
      <xsl:with-param name="list" select="."/>
   </xsl:call-template>
</xsl:template>

</xsl:stylesheet>
---------------- END STYLESHEET ---------------------


If I use the following input, for example,


---------------- BEGIN INPUT ---------------------
<numbers>12  34.5  18.2  -35</numbers>
---------------- END INPUT ---------------------


The stylesheet should get output like this:


---------------- BEGIN OUTPUT ---------------------
<?xml version="1.0" encoding="utf-8"?>3
---------------- END OUTPUT ---------------------


Instead, the stylesheet output is 


---------------- BEGIN OUTPUT ---------------------
<?xml version="1.0" encoding="UTF-8"?>
3
---------------- END OUTPUT ---------------------


The stylesheet used here is based on a stylesheet from Michael Kay's book "XSLT 
Programmer's Reference" (page 616 of the second edition), and Michael himself 
suggested that this output from Xalan is incorrect.

As Michael pointed out, "Incidentally, I think it's got another bug as well: it 
shouldn't be outputting a newline after the XML declaration. The output here is 
an XML fragment, not a well-formed XML document, and the newline is therefore 
significant. You haven't asked for a newline here, so you shouldn't get one."