xproc / 3.0-steps

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

Keep the default collection when an XSLT 3.0 stylesheet is invoked? #400

Closed gimsieke closed 4 years ago

gimsieke commented 4 years ago

As I said in https://github.com/xproc/3.0-steps/issues/395#issuecomment-625074536, I’m unhappy to our decision to make the default collection undefined for an XSLT 3 invocation, see https://spec.xproc.org/master/head/steps/#c.xslt.11

When there are multiple documents on the source port, it is understood that an XProc 3 processor processes each of them with the XSLT 3 stylesheet (“initial match selection”), as opposed to only the first of them. This is in line with the XSLT 3.0 specification.

In some of our XProc 1 pipelines, we invoke an XSLT 2 stylesheet that receives multiple documents on the source port / in the default collection. We match / (the document node of the first source document) and then, in the course of the transformation, also consider information from the other source documents by accessing collection()[2], collection()[my:conf-vocab], etc.

Switching the stylesheet to XSLT 3.0, which might be motivated by the desire to use new XSLT 3.0 constructs, will force us to change the invocation, most probably to a named template. But we need to change more, since the default collection is then undefined.

In order to keep the necessary changes to a minimum, we’d like to continue to access the other documents by collection()[2], etc. Otherwise we need to pass them as parameters, which necessitates more changes both in the stylesheet and in the invoking pipeline.

Therefore my question: Is it really important to someone that the default collection be undefined when invoking an XSLT 3 stylesheet?

If not, maybe we can keep it as in the XSLT 2 invocation case: The whole sequence of documents on the source port is the default collection.

xatapult commented 4 years ago

We need more time to investigate this because we do not want to hinder streamability and there are consequences regarding the Saxon API. Decision postponed.

xatapult commented 4 years ago

Setting the default collection might get in the way of streaming in XSLT.

xatapult commented 4 years ago

We're going to add an additional boolean option to p:xslt for XSLT 2.0 and 3.0: populate-default-collection. Default value: true.

It is ignored for 1.0 stylesheets.