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 2001/11/08 17:57:30 UTC

DO NOT REPLY [Bug 4745] New: - introduces inappropriate line-end characters processing comments

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

<xsl:copy> introduces inappropriate line-end characters processing comments

           Summary: <xsl:copy> introduces inappropriate line-end characters
                    processing comments
           Product: XalanJ2
           Version: 2.2.x
          Platform: Macintosh
        OS/Version: MacOS 9
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: angus@pobox.com


I was trying to write a template that would correctly reproduce the script 
body of a JavaScript (which is typically 'masked' by a comment). My initial 
attempt was:

<xsl:template match="script/comment()">
	<xsl:copy/>
</xsl:template>	

which worked, except that the copied script contained newline (ASCII 10) 
in place of the carriage-return (ASCII 13) characters in the original. Note 
that this is on a Macintosh, where line-endings are terminated by CR 
rather than LF; I suspect it wouldn't manifest as a problem on UN*X). My 
guess is that in this case, <xsl:copy> is causing Xalan to simply write LF's 
rather than the appropriate platform-specific line terminators.

A workaround is to use:

<xsl:template match="script/comment()">
	<xsl:comment><xsl:value-of select="."/></xsl:comment>
</xsl:template>