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. PatchForApacheCode.txt
        1 kB
        Yash Talwar
      2. patch.1966.txt
        1 kB
        Brian Minchau

        Activity

        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.
        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).
        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.
        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.
        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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development