[ http://issues.apache.org/jira/browse/XALANJ-2111?page=comments#action_64506 ] Brian Minchau commented on XALANJ-2111: ---------------------------------------
Antonio, thanks for the testcase. Unfortunately, both for 2.6.0 and for current CVS development state of Xalan-J I did not get a NPE. For the testcase that you point to, the current code in CVS, and the code in the 2.6.0 release does not use ToHTMLStream at all, as reported by you. When I run all output is through ToXMLStream, and there is good reason for this. The sytlesheet you give starts like this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:template match="page"> <html> ... ... Note the default namespace that you have specified, "http://www.w3.org/1999/xhtml", which makes the output literal element <html> to be in that default namespace. Section 16 of the XSLT 1.0 recommendation, http://www.w3.org/TR/xslt#output , says this about when no <xsl:output method... /> is specified, and a default value is used for the value of method attribute: << The default for the method attribute is chosen as follows. If - the root node of the result tree has an element child, - 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 - 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. >> We choose a default output method of xml because the expanded-name of the first element output is <html> but in a non null namespace, the default one you gave, so the output method is xml. I modified the stylesheet you pointed to, and added this: <xsl:output method="html" /> With this change the code did run through startElement() in ToHTMLStream. The literal elements in the stylesheet are in a non-null namespace and treated as XML elements. This is because section 16.2, http://www.w3.org/TR/xslt#section-HTML-Output-Method , says this: << The html output method should not output an element differently from the xml output method unless the expanded-name of the element has a null namespace URI; an element whose expanded-name has a non-null namespace URI should be output as XML. >> However the <b> copied from your input XML file where it had a null namespace, and was copied to the output tree, where it still has no namespace associated with it, so it is treated as an HTML element in this case. But I still get no NPE, both for current CVS and for 2.6.0 I'm suspecting that you are not running 2.6. Please you run org.apache.xalan.Version and see what you get out. I get this: Xalan Java 2.6.0 > NPE in o.a.xml.serializer.ToHTMLStream.endElement() > --------------------------------------------------- > > Key: XALANJ-2111 > URL: http://issues.apache.org/jira/browse/XALANJ-2111 > Project: XalanJ2 > Type: Bug > Components: Serialization > Versions: 2.6 > Environment: Cocoon 2.1.7 > Reporter: Antonio Gallardo > Attachments: dump.txt, dump.txt, output.txt > > See: http://issues.apache.org/bugzilla/show_bug.cgi?id=34386 > The solution is to comment lines blocks from 726 to 731 and 840 to 845 in > org.apache.xml.serializer.ToHTMLStream.java (current CVS). > This makes the serializer to service the SAX events as XML and this seems to > be > the cause of the trouble. -- 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]
