Re: Expanding QNames in ElementExpressions and AttributeExpressions?

Subject: Re: Expanding QNames in ElementExpressions and AttributeExpressions?
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 03 Feb 1999 17:45:43 +0700
Tyler Baker wrote:
> 
> "When comparing the name of an element to a QName, the QName is expanded
> into a local name and a possibly null URI. This expansion is done in the
> same way as for element type names in start and end-tags except that the
> default namespace declared with xmlns is not used: if the QName does not
> have a prefix, then the URI is null (this is the same way attribute
> names are expanded). The expanded element type names are compared (see
> Section 2.4.2: Element Nodes)."
> 
> This is not clear to me how the QNames for ElementExpressions and
> AttributeExpressions are expanded.  In other words, what is the context
> to use for resolving the namespace of an ElementExpression or
> AttributeExpression QName.
> 
> Is the context the stylesheet document?  In this case for a template
> match expression would the namespace be the current namespace of the
> template element for the given prefix.

Yes.  The context is the element in the stylesheet document in which the
pattern occurs. I'll add something to clarify this.

> Or is the context the current node in the source tree.  In this case for
> a template match expression would the namespace be the current namespace
> of the current node for the given prefix.
> 
> In other words for:
> 
> <xsl:template xmlns:foo="http://www.foo.com"; match="foo:bar">
> </xsl:template>
> 
> When matching an element node that belongs to the namespace
> "http://www.baz.org";, does the previous template match expression get
> resolved to

> <xsl:template xmlns:foo="http://www.foo.com";
> match="{http://www.foo.com}bar";>
> </xsl:template>
> 
> or else:
> 
> <xsl:template xmlns:foo="http://www.foo.com";
> match="{http://www.baz.org}bar";>
> </xsl:template>

The former.

James



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread