|
Attaching patch2.txt, a patch to ToHTMLStream.java
A testcase for this issue is output40.xsl in the conf/output bucket. I uses the doctype-public <xsl:output> attribute, and the document-element in the result tree is <root>, not <html>.
The gold file for this testcase is: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional"> <root> <Out> this tests nothing </Out> <Out> this tests something </Out> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <Body></Body> </HEAD> </root> I'm pretty sure that the <!DOCTYPE....> should be: <!DOCTYPE root PUBLIC "-//W3C//DTD HTML 4.0 Transitional"> Attaching patch4.txt with addresses Henry Z's review comments that the name after the DOCTYPE should be the QName not the local name.
Other minor changes since patch2 were to add comments to the "comment" and "processingInstruction" methods to make it clear that perhaps in the future these nodes can exist before the DOCTYPE is output. But for now the DOCTYPE will occur before any comments or PIs. Attaching patch5.txt which is a slight rework of patch.txt. Henry Zongaro found a bug during the review and this patch has that fix.
Henry found that a stylesheet like this: <xsl:output method="html" doctype-system='abc' /> <xsl:template match="/"> <xsl:comment>abc</xsl:comment> <html/> </xsl:template> put out two DOCTYPE declarations due to a latent bug in the comment() method, which didn't do the usual cleanup of pending issues, such as closing opening start element tags, or handling what to do if no startDocument() call was received (other methods have such code). Attaching patch6.txt - a performance improvement over the previous patch.
I have reviewed Brian's patch6.txt,[1] and I believe that it correctly resolves the problem. However, I notice that there is new code in the ToHTMLStream.characters method that appears to be redundant' it duplicates code that appears in the try-catch block immediately after the new code.
[1] http://issues.apache.org/jira/secure/attachment/12323997/patch6.txt Attaching mini-patch7.txt which catches a minor redundancy problem in ToHTMLStream.characters() method.
A condition for detecting and closing an open starting tag (which would have been triggered by a previous startElement() call) was tested twice. Henry Z. caught this in his review .... thanks Henry. I have reviewed and approve Brian's mini-patch7.txt.[2]
[2] http://issues.apache.org/jira/secure/attachment/12324030/mini-patch7.txt Patches patch6.txt and mini-patch7.txt were applied to the latest code.
The issue is fixed/resolved. This issue is no longer relevant for 2.7.1, it is fixed in 2.7.1.
Changing the affected version to 2.7. Would the originator of this issue please verify that this issue is fixed in the 2.7.1 release, by adding a comment to this issue, so that we can close this issue.
A lack of response by February 1, 2008 will be taken as consent that we can close this resolved issue. Regards, Brian Minchau |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" doctype-system="html.dtd"/>
<xsl:template match="/">
<Spider>Fly</Spider>
</xsl:template>
</xsl:stylesheet>
The output produced is:
<!DOCTYPE html SYSTEM "html.dtd">
<Spider>Fly</Spider>
The output produced should be:
<!DOCTYPE Spider SYSTEM "html.dtd">
<Spider>Fly</Spider>