Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2300

Bug with disable-output-escaping when using XSLTC and 2 TransformerHandler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.7
    • 2.7.1
    • XSLTC
    • None

    Description

      Disable-output-escaping does not work correctly in this case : it is always disabled, where it should be disabled the first time and enabled the second time.

      === Bug.java ===

      import java.io.File;

      import javax.xml.transform.sax.SAXResult;
      import javax.xml.transform.sax.SAXTransformerFactory;
      import javax.xml.transform.sax.TransformerHandler;
      import javax.xml.transform.stream.StreamResult;
      import javax.xml.transform.stream.StreamSource;

      import org.jdom.Element;
      import org.jdom.output.SAXOutputter;

      public class Bug {
      public static void main(String[] args) throws Exception

      { Element something = new Element("something"); something.addContent("<a href=\"http://www.google.com\">Google</a>"); System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"); SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory .newInstance(); System.out.println("factory = " + factory); TransformerHandler handler1 = factory .newTransformerHandler(new StreamSource(new File("foo.xsl"))); TransformerHandler handler2 = factory.newTransformerHandler(); handler2.setResult(new StreamResult(System.out)); handler1.setResult(new SAXResult(handler2)); new SAXOutputter(handler1).output(something); }

      }

      === foo.xsl ===

      <?xml version="1.0"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
      Yes: <xsl:value-of select="/something" disable-output-escaping="yes" />
      No: <xsl:value-of select="/something" disable-output-escaping="no" />
      </xsl:template>
      </xsl:stylesheet>

      Attachments

        1. StringValueHandler.patch.txt
          0.4 kB
          Brian Minchau

        Issue Links

          Activity

            People

              Unassigned Unassigned
              powro Andre Powroznik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: