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/09/06 21:28:58 UTC

DO NOT REPLY [Bug 12377] New: - TCK: Output method is not set to html when it should

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

TCK: Output method is not set to html when it should

           Summary: TCK: Output method is not set to html when it should
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: mkwan@ca.ibm.com


>From Section 16 (for xsl:output) of the XSLT 1.0 spec:

The default for the method attribute is chosen as follows. If

1. the root node of the result tree has an element child,

2. the expanded-name of the first element child of the root node (i.e. the 
document element) of the result tree has local part html (in any combination of 
upper and lower case) and a null namespace URI, and

3. any text nodes preceding the first element child of the root node of the 
result tree contain only whitespace characters,

then the default output method is html; otherwise, the default output method is 
xml. 

-------------------------------------------------------------------------------

In the following example program, the output method should be set to "html". It 
is currently set to "xml".

Demonstration code:

import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.util.*;
import java.io.*;

public class OutputPropertiesTest
{
   private static String XSL1 =  "<?xml version='1.0'?>\n"
                       + "<xsl:stylesheet version='1.0'"
                       + " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>\n"
                       + "  <xsl:template match='/'>\n"
                       + "\n"
                       + "<html>\n"
                       + "  <body><xsl:copy-of select='/info/*'/></body>\n" 
                       + "</html>\n"
                       + "\n"
                       + "  </xsl:template>\n"
                       + "</xsl:stylesheet>\n";
                               
   public static void main(String[] args)
   {
        StreamSource source = new StreamSource(new StringReader(XSL1));
        
        Templates templates = null;
        try {
            templates = TransformerFactory.newInstance().newTemplates(source);
        } 
        catch (TransformerException e) {
            System.out.println("Error: TransformerException is thrown");
        }
        
        Properties properties = templates.getOutputProperties();
        String method = properties.getProperty("method");
        System.out.println("The method property is: " + method);

    }
}

=====================================================================

Expected output:
The method property is: html

Current output:
The method property is: xml