Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-2118730

XSLT output type XML does not honor {http://xml.apache.org/xslt}indent-amount in

XMLWordPrintable

    • Icon: Backport Backport
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • None
    • xml

      See Description Note of parent CR 5064280.
      Note: I cannot find the original description, since Bugster just says

      "See Description Note of parent CR 5064280."

      so I am assuming that I originally filed this about supporting

      <xsl:output method="xml" indent="yes" xalan:indent-amount="4" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xslt"/>

      which does in fact seem to work fine in both 1.5.0_04 and Mustang b45. I.e. this works:

      String xslt =
              "<xsl:stylesheet version='1.0' " +
              "xmlns:xsl='http://www.w3.org/1999/XSL/Transform&#39; " +
              "xmlns:xalan='http://xml.apache.org/xslt&#39; " +
              "exclude-result-prefixes='xalan'>" +
              "<xsl:output method='xml' indent='yes' xalan:indent-amount='4'/>" +
              "<xsl:template match='@*|node()'>" +
              "<xsl:copy>" +
              "<xsl:apply-templates select='@*|node()'/>" +
              "</xsl:copy>" +
              "</xsl:template>" +
              "</xsl:stylesheet>";
      Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(xslt)));
      t.transform(..., ...);

      but this does not:

      Transformer t = TransformerFactory.newInstance().newTransformer();
      t.setOutputProperty(OutputKeys.INDENT, "yes");
      t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
      t.transform(..., ...);

      Newlines are printed but no indentation, despite the output property.

            ayadavsunw Arun Yadav (Inactive)
            jglick Jesse Glick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: