In his talk at XmlPrague (now online at https://so.nwalsh.com/2020/02/15/xproc-30) Norm, when presenting the XSLT 3 code sample to transform JSON (a JSON/XDM 3.1 array of maps) to CSV, made the following comment:
It has no primary input document. Note, in particular, that I couldn’t pass the map to the step as its primary input. Maps aren’t nodes, so you can’t do that.
The p:xslt step presented then used the option for the global-context-item and an empty input source port together with a named template:
I asked on Norm's blog whether the remark about the impossibility to use a map as the primary input to p:xslt is due to his implementation or a general restriction by the spec.
On digging further, I also found the test case https://test-suite.xproc.org/tests/ab-xslt-016.html by Achim which seems to do what Norm says is not possible, namely it does seem to use a JSON map as the primary input.
Representations of JSON documents are instances of the XDM. They are maps, arrays, or atomic values
So based on Achim's test case and based on that definition of a JSON document I think the remark by Norm, based on what his implementation allows, suggests that his implementation is not yet correct in terms of dealing with XDM maps or arrays as the primary input of an XSLT 3 stylesheet in the p:xslt step and it should be possible to use the JSON result from the previous step directly as the input with e.g.
In his talk at XmlPrague (now online at https://so.nwalsh.com/2020/02/15/xproc-30) Norm, when presenting the XSLT 3 code sample to transform JSON (a JSON/XDM 3.1 array of maps) to CSV, made the following comment:
The
p:xslt
step presented then used the option for theglobal-context-item
and an empty input source port together with a named template:I asked on Norm's blog whether the remark about the impossibility to use a map as the primary input to
p:xslt
is due to his implementation or a general restriction by the spec.On digging further, I also found the test case https://test-suite.xproc.org/tests/ab-xslt-016.html by Achim which seems to do what Norm says is not possible, namely it does seem to use a JSON map as the primary input.
Furthermore looking at https://spec.xproc.org/master/head/xproc/#json-documents it says:
So based on Achim's test case and based on that definition of a JSON document I think the remark by Norm, based on what his implementation allows, suggests that his implementation is not yet correct in terms of dealing with XDM maps or arrays as the primary input of an XSLT 3 stylesheet in the
p:xslt
step and it should be possible to use the JSON result from the previous step directly as the input with e.g.