[ http://issues.apache.org/jira/browse/XALANJ-656?page=comments#action_12363702 ]
Brian Minchau commented on XALANJ-656: -------------------------------------- I just ran this stylesheet with Xalan-J 2.7.0: --------------------------------------------------------- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xalan"> <xsl:output method="xml" indent="yes" xalan:line-separator="EOL" /> <xsl:template match="/"><out></out><xsl:comment>Newline in a comment: Next line Eight</xsl:comment><out2>Newline in text node: Next line in text</out2></xsl:template></xsl:stylesheet> --------------------------------------------------------- Note that it uses the xalan specific line-separator property introduced in version 2.7. It sets the end of line separator to the unrealistic, but very visible value of "EOL". Obviously a better attribute value would be " " The output from the stylesheet above is: -------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?>EOL<out xmlns:xalan="http://xml.apache.org/xalan"/>EOL<!--Newline in a comment: Next line Eight-->EOL<out2 xmlns:xalan="http://xml.apache.org/xalan">Newline in text node:EOLNext line in text</out2>EOL -------------------------------------------------------- So there is a way to specify the end of line characters, and it works within a text node, you can see the "EOL" in the middle of the output text. However, I think the issue here is that an end of line sequence in a comment is left as-is. Is that it? Is one wishing the output to be this for the comment: <!--Newline in a comment:EOLNext lineEOLEight--> Even so, is this allowed within the XSLT 1.0 specification on how comments are processed? > <xsl:copy> introduces inappropriate line-end characters processing comments > --------------------------------------------------------------------------- > > Key: XALANJ-656 > URL: http://issues.apache.org/jira/browse/XALANJ-656 > Project: XalanJ2 > Type: Bug > Components: Xalan > Versions: 2.2.0 > Environment: Operating System: MacOS 9 > Platform: Macintosh > Reporter: Angus McIntyre > Assignee: Xalan Developers Mailing List > Priority: Minor > > 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> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
