Nathan -- I agree with everything Santiago said. However, he did not specifically address your issue with the part of the javadoc that refers to "... properties are "defaulted" by default properties specified by section 16 of the XSL Transformations (XSLT) W3C Recommendation."
In that regard, I think that there is room for improvement in the javadoc. With respect to JAXP and the static view of the OutputProperties visible from the stylesheet (ie without running the transformation), the javadoc should state that it is assumed that the default for the method attribute is always "xml". I'm not exactly sure how to word this. Perhaps, the javadoc should just state: For purposes of this method, the default value for the property specified by OutputKeys.METHOD is always "xml". In other words, if no value is specified for this property in either setOutputProperty(java.lang.String, java.lang.String) nor in setOutputProperties(java.util.Properties), nor in the stylesheet, then the default value will be "xml". Gary > -----Original Message----- > From: Santiago Pericas-Geertsen > [mailto:[EMAIL PROTECTED] > Sent: Monday, July 22, 2002 4:33 PM > To: Beyer,Nathan; Xalan-J-User (E-mail) > Cc: Rajiv Mordani > Subject: Re: Default Output Method in Xalan 2.2 > > > > According to the Javadoc on Sun's site > > > <http://java.sun.com/j2se/1.4/docs/api/javax/xml/transform/Tra > nsformer.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 > >
