Re: Bug 4378: absent context item

> On 4 Nov 2015, at 13:21, Tim Mills <tim@cbcl.co.uk> wrote:
> 
> I think it is unfortunate that we say that the "context item static type component is absent[DM30]." without saying in 2.1.1 Static Context:
> 
> [Definition: Context item static type. This component defines the static type of the context item within the scope of a given expression.  It may be a type, or absent ]
> 
> The above change would make it clear that this component of the static context can be absent.

But it doesn’t make it clear what the absence of the component means. Does it mean there will be no context item, or does it mean we don’t know whether or not there will be a context item, or does it mean there will be a context item but we don’t know anything about its type?

> 
> Looking at XSLT's context item declaration, it appears that XSLT never permits the static type of the context item to be absent because
> 
> <xsl:global-context-item use="absent" />
> 
> is equivalent to
> 
> <xsl:global-context-item use="absent" as="item()" />
> 
> It's quite explicit: the value may be absent, but it's static type definitely is not.

Actually this declaration isn’t allowed (in the latest draft): use=“absent” means there will be no context item, and you’re not allowed to specify a type for something that won’t ever exist. Only one possible state for the context item is permitted with this declaration, namely absence.

Omitting a global-context-item declaration is equivalent to specifying

> <xsl:global-context-item use=“optional" as="item()" />

This declaration defines the set of possible states of the context item to include any item, plus absence.

I don’t find the notion of the static type being “absent” helpful without a clear understanding of what the absence of a static type tells us about the set of possible dynamic states. 

Michael Kay
Saxonica

Received on Thursday, 5 November 2015 09:10:54 UTC