XalanJ2
  1. XalanJ2
  2. XALANJ-1966

XSL Transformation drops content inside xsl:comment tags.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7
    • Component/s: Serialization
    • Labels:
      None
    • Environment:
      Windows 2000. Xalan 2.6.0

      Description

      With Xalan 2.6.0, when a simple stylesheet, say test.xsl and input xml, say test.xml is used, transformation works fine.

      If simple test.xsl file include or import other stylesheets and imported/included stylesheets import/include more stylesheets, then, transformation works; however, in the final output (html), content inside xsl:comment tags are dropped. I have a big application that produced this problem. I cannot provide a simpler version of the testcase. However, I have resolved the issue by making one minor change in the code. I will provide the patch that resolved my problem.

      1. patch.1966.txt
        1 kB
        Brian Minchau
      2. PatchForApacheCode.txt
        1 kB
        Yash Talwar

        Activity

        Yash Talwar created issue -
        Brian Minchau made changes -
        Field Original Value New Value
        Project AltRMI [ 10101 ] XalanJ2 [ 10584 ]
        Component/s Serialization [ 11325 ]
        Affects Version/s CurrentCVS [ 10863 ]
        Key ARMI-5 XALANJ-1966
        Hide
        Yash Talwar added a comment -

        Interface org.xml.sax.ext.LexicalHandler declares methods to take care of comments during transformation. In class, org.apache.xml.serializer.ToHTMLSAXHandler, the reference to LexicalHandler is set to null. The proposed patch ensures that the reference to LexicalHandler does not get set to null and code integrity remains. This resolves the issue that I have seen in my application.

        Show
        Yash Talwar added a comment - Interface org.xml.sax.ext.LexicalHandler declares methods to take care of comments during transformation. In class, org.apache.xml.serializer.ToHTMLSAXHandler, the reference to LexicalHandler is set to null. The proposed patch ensures that the reference to LexicalHandler does not get set to null and code integrity remains. This resolves the issue that I have seen in my application.
        Yash Talwar made changes -
        Attachment PatchForApacheCode.txt [ 17769 ]
        Hide
        Brian Minchau added a comment -

        Patch patch.1967.txt is the same patch but with spaces rather than tabs ( to reduce differences in the patch).

        Show
        Brian Minchau added a comment - Patch patch.1967.txt is the same patch but with spaces rather than tabs ( to reduce differences in the patch).
        Brian Minchau made changes -
        Attachment patch.1966.txt [ 17846 ]
        Hide
        Brian Minchau added a comment -

        Patch patch.1966.txt was applied to CVS, please verify the fix.

        Show
        Brian Minchau added a comment - Patch patch.1966.txt was applied to CVS, please verify the fix.
        Brian Minchau made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Chris Bowditch added a comment -

        I have been trying to work out why xsl:comment did not appear to work when generating HTML for a long while now. Its not immediately obvious from the bug description that this bug is the cause. The precise re-creation steps are:

        1) perform a SAX based transform that generates HTML
        2) Specify a destination systemId and publicId

        In these circumstances, xsl:comment has no affect on output! The attached patch fixes the issue.

        Show
        Chris Bowditch added a comment - I have been trying to work out why xsl:comment did not appear to work when generating HTML for a long while now. Its not immediately obvious from the bug description that this bug is the cause. The precise re-creation steps are: 1) perform a SAX based transform that generates HTML 2) Specify a destination systemId and publicId In these circumstances, xsl:comment has no affect on output! The attached patch fixes the issue.
        Brian Minchau made changes -
        Fix Version/s 2.7 [ 11080 ]
        Hide
        Brian Minchau added a comment -

        This issue is no longer relevant for 2.7.1, it is fixed in 2.7.1.
        Changing the affected version to 2.7.

        Show
        Brian Minchau added a comment - This issue is no longer relevant for 2.7.1, it is fixed in 2.7.1. Changing the affected version to 2.7.
        Brian Minchau made changes -
        Affects Version/s 2.7 [ 11080 ]
        Affects Version/s 2.7.1 [ 10863 ]
        Mark Thomas made changes -
        Workflow jira [ 37437 ] Default workflow, editable Closed status [ 12570500 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12570500 ] jira [ 12594560 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Yash Talwar
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development