xmlcalabash / xmlcalabash3

XML Calabash 3.x, an implementation of XProc 3.x
MIT License
5 stars 2 forks source link

In AVT of message attribute, with context item being an XDM array, the XPath ?* gives "err:XD0030: Step failed: “The context item is absent”" #9

Closed martin-honnen closed 1 day ago

martin-honnen commented 4 days ago

In the pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0"
    xmlns:c="http://www.w3.org/ns/xproc-step"
    xmlns:array="http://www.w3.org/2005/xpath-functions/array"
    exclude-inline-prefixes="#all">
    <p:input port="source">
        <root>
            <test>foo</test>
        </root>
    </p:input>
    <p:output port="result" sequence="true"/>
    <p:json-join>
        <p:with-input pipe="source source source source source"/>
    </p:json-join>
    <p:identity message="{every $doc in ?* satisfies $doc instance of document-node()}"/>
</p:declare-step>

I (with alpha2) get an error Fatal err:XD0030: Step failed: “The context item is absent”..

If I write .?* the error goes away and I get the result I expect but I think just using ?* should work as well.

Coincidentally, I filed nearly the same bug https://sourceforge.net/p/morganaxproc-iiise/tickets/179/ a short while ago on Morgana XProc III and Achim there agreed it is a bug and fixed that.

ndw commented 4 days ago

Yes. I can believe that's a bug. I had quite a surprise a few weeks ago when I discovered how primitive my XPath 3 parsing actually was. I've tried to improve it, but it's very difficult to be sure it's correct. (And because of the way the APIs are constructed, it wasn't practical to use the Saxon parser; I'm parsing with REx and that has its own wrinkles.)