DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=29706>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=29706 Carriage returns in HTML output Summary: Carriage returns in HTML output Product: XalanJ2 Version: 2.6 Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: Xalan AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I create an attribute that contains one linefeed. The HTML output, for which I use this attribute value as the content of a tag, contains a carriage return and a linefeed (0D 0A). If I use the attribute in a HTML tag attribute then it contains two carriage return and a linefeed (0D 0D 0A). I use the following XSL: ********************** <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" doctype-system="http://www.w3.org/TR/REC-html40/loose.dtd" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/> <xsl:template match="root"> <html> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> <div> <xsl:attribute name="id"> <xsl:value-of select="@test"/> </xsl:attribute> <xsl:value-of select="@test"/> </div> </body> </html> </xsl:template> </xsl:stylesheet> ********************** This is the method that creates the output ********************** public static void test() throws TransformerException, IOException { Document doc = new DocumentImpl(); Element root = doc.createElement("root"); root.setAttribute("test","line1\nline2"); doc.appendChild(root); TransformerFactory tFactory = TransformerFactory.newInstance(); File xslFile = new File("c:\\test.xsl"); Transformer transformer = tFactory.newTransformer(new StreamSource (xslFile)); File outputFile = new File("c:\\test.html"); FileWriter writer = new FileWriter(outputFile); transformer.transform(new DOMSource(doc), new StreamResult(writer)); writer.close(); } ********************** The result output will contain OD OA in the contents of the div tag. And 0D 0D 0A in the id attribute value. Note: the Xalan environment check reports the following: ********************** #---- BEGIN writeEnvironmentReport($Revision: 1.26 $): Useful stuff found: ---- version.DOM.draftlevel=2.0fd java.class.path=D:\lib\j2sdk1.4.2_03\jre\lib\charsets.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\jce.jar;D:\lib\j2sdk1.4.2_03\jre\lib\jsse.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\plugin.jar;D:\lib\j2sdk1.4.2_03\jre\lib\rt.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\sunrsasign.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\ext\dnsns.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\ext\ldapsec.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\ext\localedata.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\ext\sunjce_provider.jar;G:\XalanTest\classes;D:\lib\xalan-j_2_6_0 \bin\xalan.jar;D:\lib\xerces-2_6_2\xercesImpl.jar;D:\lib\xerces-2_6_2 \xmlParserAPIs.jar;C:\winapps\IntelliJ-IDEA-4.0\lib\idea_rt.jar version.JAXP=1.1 or higher java.ext.dirs=D:\lib\j2sdk1.4.2_03\jre\lib\ext #---- BEGIN Listing XML-related jars in: foundclasses.sun.boot.class.path ---- xalan.jar-path=D:\lib\j2sdk1.4.2_03\jre\lib\endorsed\xalan.jar xercesImpl.jar-apparent.version=xercesImpl.jar from Xerces-J-bin.2.6.2 xercesImpl.jar-path=D:\lib\j2sdk1.4.2_03\jre\lib\endorsed\xercesImpl.jar xml-apis.jar-apparent.version=xml-apis.jar from tck-jaxp-1_2_0 branch of xml- commons, tag: xml-commons-external_1_2_01 xml-apis.jar-path=D:\lib\j2sdk1.4.2_03\jre\lib\endorsed\xml-apis.jar #----- END Listing XML-related jars in: foundclasses.sun.boot.class.path ----- version.xerces2=Xerces-J 2.6.2 version.xerces1=not-present version.xalan2_2=Xalan Java 2.6.0 version.xalan1=not-present version.ant=not-present java.version=1.4.2_03 version.DOM=2.0 version.crimson=present-unknown-version sun.boot.class.path=D:\lib\j2sdk1.4.2_03 \jre\lib\endorsed\xalan.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\endorsed\xercesImpl.jar;D:\lib\j2sdk1.4.2_03\jre\lib\endorsed\xml- apis.jar;D:\lib\j2sdk1.4.2_03\jre\lib\rt.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\i18n.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\sunrsasign.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\jsse.jar;D:\lib\j2sdk1.4.2_03\jre\lib\jce.jar;D:\lib\j2sdk1.4.2_03 \jre\lib\charsets.jar;D:\lib\j2sdk1.4.2_03\jre\classes #---- BEGIN Listing XML-related jars in: foundclasses.java.class.path ---- xalan.jar-path=D:\lib\xalan-j_2_6_0\bin\xalan.jar xercesImpl.jar-apparent.version=xercesImpl.jar from Xerces-J-bin.2.6.2 xercesImpl.jar-path=D:\lib\xerces-2_6_2\xercesImpl.jar #----- END Listing XML-related jars in: foundclasses.java.class.path ----- version.SAX=2.0 version.xalan2x=Xalan Java 2.6.0 #----- END writeEnvironmentReport: Useful properties found: ----- # YAHOO! Your environment seems to be OK. ********************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
