This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Under 6.7 Declaring the Context Item (http://www.w3.org/TR/xslt-30/#declaring-context-item) the syntax for xsl:context-item defines the use attribute as optional attribute with one of three values, required, optional, prohibited. Under the second paragraph of 6.7.1 the text says "When the xsl:context-item element appears as a child of xsl:mode, the only permitted value for the use attribute is required" but doesn't mention what happens when the use attribute is omitted when xsl:context-item is used as child of xsl:mode (error? default to required?). For other uses, as in a child of xsl:template, there is no mention either of what the default value for this attribute should be. Indirectly, from the first example at the bottom of 6.7.1 we can deduct that the default is "required". Under 6.7.2, third paragraph, the text says (in the middle): "If the containing xsl:template element has no name attribute then the only permitted value is required." same applies here as for the xsl:context-item under xsl:mode. It is not trivial to deduct what the default should be. My guess is that the default for a template with a name attribute should be "optional" and the default for xsl:mode or an xsl:template without a name attribute should be "required". Or alternatively, not specifying the use attribute other than when the default is allowed to be "optional" (as that same third paragraph describes), is an error. Note also the line under 6.7.1 (last line before example): "If there is no xsl:context-item element for an xsl:mode that specifies initial="yes", this is equivalent to specifying <xsl:context-item as="item()"/>" It's probably better that we be more explicit here, i.e., give the use attribute as well.
Just to illustrate: <xsl:mode> <xsl:context-item as="document-node()" /> </xsl:mode> <xsl:template match="*"> <xsl:context-item as="element(foo)" /> </xsl:template> <xsl:template name="bar"> <xsl:context-item as="xs:string" /> </xsl:template> The defaults for these context items are different in respect to the omitted @use attribute. Is it allowed to omit it and if it can be omitted, is the default the assumed default (resp. required, required, optional)?
We discussed this in Prague. Some WG members suggested that it might be most usable not to declare defaults for the @use attributes. Others countered that since the xsl:context-item element itself is optional, there must necessarily be a default behavior. After discussion we agreed with the following resolution: define the default value of xsl:mode/xsl:context-item/@use as 'required'. For context-item within template, the default is already specified (indirectly) as 'optional'.
Closed as suggested.