> According to the Javadoc on Sun's site > <http://java.sun.com/j2se/1.4/docs/api/javax/xml/transform/Transformer.html# > getOutputProperties()>, the method documentation states - > "The properties returned should contain properties set by the user, and > properties set by the stylesheet, and these properties are "defaulted" by > default properties specified by section 16 of the XSL Transformations (XSLT) > W3C Recommendation." > > Which basically says the defaults should be set according to section 16 of > the XSLT spec <http://www.w3.org/TR/xslt#output>. I read section 16 and it > explicit states - > "The default for the method attribute is chosen as follows. If > * the root node of the result tree has an element child, > > * the expanded-name of the first element child of the root node (i.e. the > document element) of the result tree has local part html (in any > combination of upper and lower case) and a null namespace URI, and > > * any text nodes preceding the first element child of the root node of the > result tree contain only whitespace characters, > > then the default output method is html; otherwise, the default output > method is xml. The default output method should be used if there are no > xsl:output elements or if none of the xsl:output elements specifies a value > for the method attribute." > > My interpretation of these two documents is that I should be getting back a > default value of "html" for "method" if my stylesheet follows the section 16 > rules. The XSL file I included in my original email follows these rules, > correct?
Nathan: Section 16 refers to the "result tree" not the stylesheet. In general, it is impossible (i.e. undecidable) to determine the shape of the result tree without running the transformation. In fact, it is easy to write a stylesheet that depending on the value of a parameter outputs, say, HTML or XML. Thus, even though it would be possible to query a Transformer after calling transform(), I don't believe this was considered in the original design. The JAXP documentation refers to the "properties set by the stylesheet" to those set in xsl:output since, as I mentioned above, it is not possible to talk about the "properties of the result tree" without running the transformation. Perhaps what is needed is an additional method to query the output method of the last transformation. -- Santiago Pericas-Geertsen Sun Microsystems
