meaning of "contain" in the XSLT spec

I wrote:
> > http://www.w3.org/TR/xslt#creating-attributes says, 
> > "Instantiating an xsl:attribute element adds an
> > attribute node to the containing result element
> > node". It's not terribly clear, but the
> > "containing" node is the <xsl:attribute>'s parent,
> > which is <xsl:when> in your example. You want the
> > parent to be a result element, i.e. a literal
> > result element like <label> or an <xsl:element>
> > instruction.

Mike Kay wrote:
> Oh! Is that a definitive interpretation?

David Carlisle wrote:
> I hope not:-)

Mike Kay continued:
> (a) "Containing" surely allows an ancestor as well
> as a parent, (b) I thought it was talking about the
> result tree not the stylesheet tree.

That was actually my initial interpretation, as well, but the reported
failure of the code fragment that was posted led me to revise it, smarties
:)

Aside from the example above, there are various other places where "contain"
is used ambiguously in the XSLT spec, so I'll cc: this to the editors. Here
are further examples of the use of "contain" to sometimes to refer to
parent-child releationships, other times to imply a broader sense of
containment:

Section 1
"A stylesheet contains a set of template rules." and "A template can contain
elements that specify literal result element structure. A template can also
contain elements that are instructions for creating result tree fragments."

These are very general statements where the correct interpretation is that
result elements may exist somewhere within a stylesheet, but exactly where
is not being specified. That's fine, but...

Section 2
"The xsl:stylesheet element may contain the following types of elements:
 xsl:import xsl:include xsl:strip-space xsl:preserve-space xsl:output
xsl:key xsl:locale  xsl:attribute-set xsl:variable xsl:param xsl:template"
and "...stylesheets may contain zero or more of each of these elements"

While these aren't inaccurate statements, the correct interpretation is that
this is a specific form of containment -- these are the *only* elements
allowed as *children* of xsl:stylesheet.

"In addition, the xsl:stylesheet element may contain any element not from
the XSLT namespace, provided that the expanded name of the element has a
non-null namespace URI."

This was the subject of some commentary by a certain two fellows on the list
2 weeks ago (Sep 16 and 17, 1999). One of those gentlemen said, 'My reading
of "contains" here is "immediately contains"; i.e. XSLT will ignore unknown
elements that are immediate children of xsl:stylesheet' :-)

"Such a stylesheet is equivalent to a stylesheet with an xsl:stylesheet
element containing a template rule containing the literal result element;
the template rule has a match pattern of /."

Again, containment seems to apply only to immediate children.

And so on...

Mike

Received on Friday, 1 October 1999 11:53:25 UTC