You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So can't we define that the context item always exists and is always the sequence of documents that's flowing through?
No document? Empty sequence
Single document? Just as it is now
Multiple documents? Sequence of item() representing the documents (in the right order!). So document-node() for documents, maps or arrays for JSON, etc.
In retrospect, isn't the whole thing with making sequence of documents special (the use of the collection attribute) an XProc/XPath 1.0 left-over?
It would also solve #22. You could simply write count(.) to get the number of documents and exists(.) or empty(.) to check whether a document is there.
The text was updated successfully, but these errors were encountered:
Currently the context item only exists when a single document is flowing through the pipeline. Assume this is an XML document:
But when a sequence of document is possible and there is no or multiple document(s), there is no context item.
That leads to some weird coding problems. For instance, I want to catch the results on the error port of
p:os-exec
. What I intuitively do is:But this doesn't fly because when there is no error, there is no context item... Why? I have to resort to clumsy looking solutions like:
So can't we define that the context item always exists and is always the sequence of documents that's flowing through?
item()
representing the documents (in the right order!). Sodocument-node()
for documents, maps or arrays for JSON, etc.In retrospect, isn't the whole thing with making sequence of documents special (the use of the
collection
attribute) an XProc/XPath 1.0 left-over?It would also solve #22. You could simply write
count(.)
to get the number of documents andexists(.)
orempty(.)
to check whether a document is there.The text was updated successfully, but these errors were encountered: