RE: Differences between xsl:element and LRE

> There are a couple of differences between xsl:element and 
> LREs that I think could have been more clear in the XSLT 1.0 
> spec; since the 2.0 spec doesn't seem to have changed either 
> of these things, I'm bringing them up as a suggestion for how 
> to improve the Working Draft.
> 
> The first difference has to do with namespace aliases.  It 
> seems to me that there is no interaction between xsl:element 
> and namespace-aliases. However, I don't think is crystal 
> clear.  I think putting a single sentence in xsl:element to 
> the effect of
> 
> 	"Namespace aliases have no effect on the resulting element."
> 
> would be helpful.

The section 11.1.4 in which Namespace Aliasing is described is part of
section 11.1 which describes literal result elements, and it states clearly
that namespace aliases apply to:

<quote>
    * the namespace URI in the expanded-QName of a literal result element in
the stylesheet
    * the namespace URI in the expanded-QName of an attribute specified on a
literal result element in the stylesheet
    * the string value of a namespace node on a literal result element in
the stylesheet.
</quote>

So I don't think there can be any room for doubt that it doesn't apply to
names in xsl:element. The difficulty in adding a note under xsl:element
would be that people might then worry that there was no equivalent note
under xsl:attribute, or xsl:namespace, any of the other places where
namespace aliases are not relevant.
> 
> Furthermore, I would add another sentence along the lines of:
> 
> 	"Elements generated with xsl:element have no implied namespace
> 	bindings other than those required to be a valid XML 
> 1.0 document."
> 
> Since that seems to be the intent of the spec, but is not 
> explicitely stated.
> 

The specification for xsl:element states:

"The content of the xsl:element instruction is a sequence constructor for
the children, attributes, and namespaces of the created element. The
sequence obtained by evaluating this sequence constructor is used to
construct the content of the element, as described in 5.6.1 Constructing
Complex Content."

If you follow the reference to 5.6.1, it makes it clear that the namespace
nodes for the new element (which is what I imagine you mean by the "implied
namespace bindings") are (a) the namespace nodes that are present in the
result of evaluating the sequence constructor, and (b) the namespace nodes
created by the namespace fixup process described in 5.6.3.

I realise that the specification in this area is not easy to read, and that
some examples might help. Your summary of the rules is reasonably correct,
but it does not cover all cases, and I fear that if it were expanded to make
it completely correct, then it would amount to a respecification of the
current rules using different language, which would simply create the risk
of inconsistency.

Thanks for the comments.

Michael Kay

Received on Monday, 2 June 2003 08:20:04 UTC