[Bug 4031] Final Result Trees

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4031





------- Comment #9 from mike@saxonica.com  2006-12-15 19:53 -------
>But I am still not convinced by this sentence in Section "19 Final Result Trees" (please read my comment #0):

>"A final result tree can be created explicitly, by evaluating an xsl:result-document instruction. A final result tree is also created implicitly if no xsl:result-document instruction is evaluated, or if the result of evaluating the initial template is a non-empty sequence."

Consider the following cases:

(a)
<xsl:template match="/"/>

(b)
<xsl:template match="/">
  <xsl:result-document><a/></xsl:result-document>
</xsl:template>

(c)
<xsl:template match="/">
  <a/>
</xsl:template>

(d)
<xsl:template match="/">
  <a/>
  <xsl:result-document href="2.xml"><a/></xsl:result-document>
</xsl:template>

An implicit result tree is created in cases (a), (c), and (d), but not in case
(b). In case (a) it is created because no xsl:result-document instruction has
been executed. In cases (c) and (d) it is created because the result of the
initial template is non-empty. It is only necessary for one of these conditions
to be true. If we said "and", then it would be necessary for both conditions to
be true, which means we would not create an implicit result tree in case (a).
But we made a deliberate and conscious decision that we should create an
implicit result tree (containing a document node with no children) in case (a),
partly for backwards compatibility and partly because it seems the right thing
to do.

Received on Friday, 15 December 2006 19:53:29 UTC