You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2005/06/04 00:52:44 UTC

[jira] Commented: (XALANJ-1895) Carriage returns in HTML output

    [ http://issues.apache.org/jira/browse/XALANJ-1895?page=comments#action_12312593 ] 

Brian Minchau commented on XALANJ-1895:
---------------------------------------

It may be of interest to know that XALANJ-2093, which will be in the Xalan-J 2.7 release, will allow you to specify what \n is normalized to on output. For example, you can pick <xsl:output xalan:line-separator="&#10;" > and it won't use the runtime library value for the line separator. That should give the user any control on this carriage-return issue. 

> Carriage returns in HTML output
> -------------------------------
>
>          Key: XALANJ-1895
>          URL: http://issues.apache.org/jira/browse/XALANJ-1895
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: 2.6
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: Robert van Loenhout
>     Assignee: Brian Minchau
>  Attachments: patch2.txt
>
> 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.
> **********************

-- 
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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org