xproc / 3.0-steps

Repository for change requests to the standard step library and for official extension steps
10 stars 7 forks source link

Global context item (again) #410

Closed xml-project closed 4 years ago

xml-project commented 4 years ago

Sorry, but it is not possible to implement our current ruling with Saxon. We say

If there are none or multiple documents on the source port, its value will be the empty sequence

There is no way to set the global context item to the empty sequence. It is an item, so it is either present or absent.

xatapult commented 4 years ago

?? Doesn't "absent" in practice mean, within your stylesheet: The empty sequence?

So, on a global level, when there is no global context item: empty(/) is true?

xatapult commented 4 years ago

I don't necessarily disagree, I just don't dig the difference between "absent" and "the empty sequence".

If absent doesn't mean "the empty sequence", then empty(/) would result in an error?

xml-project commented 4 years ago

Sorry for not being precise: I am talking about XProc -> XSLT, not how an absent GCI is represented in the stylesheet. The specs say, the XProc implementation should set the global context item to () when calling the XSLT processor. This is not possible with Saxon because it expects an instance of XdmItem. I think this is in accordance with the XSLT specs.

ndw commented 4 years ago

The distinction between 'absent' and 'empty sequence' is generally that attempts to refer to an absent item raise an error. I think what we mean to say is that if a sequence of documents appears, the global context item will be absent. (I.e., we won't attempt to set it to anything.)

At the risk that I'm forgetting some previous discussion, does it make more sense to simply say that the global-context-item is specified if and only if the p:xslt step explicitly sets it? I imagine that most stylesheets take their input from the initial match selection anyway.

xml-project commented 4 years ago

@ndw I think this is what I did with PR #412 . What did I miss?

ndw commented 4 years ago

It's fine. I was mostly answering question about the distinction between empty and absent.

I don't really undertand the motivation for ever setting the global-context-item by default, but I think I lost that argument so I'm not trying to reopen the issue. Merge at will!