xsl-list
[Top] [All Lists]

[xsl] Re: What is the default global context item?

2020-05-04 05:22:46
It depends on the processor's API.

For Saxon, we effectively have two kinds of API: legacy APIs where the "initial 
match selection" and "global context item" are the same thing, and 3.0-specific 
APIs where they are set independently. You need to read the specs for the 
particular API you are using. By default the global context item is undefined 
("absent").

Some of the 3.0 changes were for streaming - in particular the option to have 
an initial match selection (typically the streamed input document) without 
having a global context item.

But it's more complex than that: 2.0 allows you to set a global context item 
for named-template invocation (where there's no initial match selection), and 
even in 1.0, there's some rule somewhere (can't remember if it's in the 
language spec or in some API spec) whereby if the initial match selection is a 
non-document node, then the global context item is the document root of the 
tree containing that node.

Michael Kay
Saxonica

On 4 May 2020, at 10:53, Erik Siegel <erik(_at_)xatapult(_dot_)nl> wrote:

Hi all (and maybe especially @Michael Kay 
<mailto:mike(_at_)saxonica(_dot_)com>)
 
In implementing XSLT 3 conversions for XProc 3.0 pipelines we ran into this 
issue:
 
What is the global context item for an XSLT 3.0 stylesheet when none is set 
explicitly? 
 
I’ve tried to find it in the XSLT 3 spec but found it hard to find the 
definite answer. In practice however (for XML conversions)  I noticed it’s 
the document-node of the main input document. But is that because the XSLT 3 
spec says so or just a convenient default of Saxon?
 
Hope anyone can help us out,
Erik Siegel
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Re: What is the default global context item?, Michael Kay mike(_at_)saxonica(_dot_)com <=