W3C home > Mailing lists > Public > xproc-dev@w3.org > March 2020

Node identity in XProc 3

From: Martin Honnen <martin.honnen@gmx.de>
Date: Tue, 3 Mar 2020 11:13:12 +0100
To: xproc-dev@w3.org
Message-ID: <23edad97-d93b-308a-c25d-a65f70281412@gmx.de>

I have started to explore XProc 3 using the MorganaXProc-IIIse
0.9.0-beta; what I always wondered reading the spec where XDM values as
XProc documents are flowing through the pipeline is whether the node
identity of XDM nodes is supposed to be preserved or whether that is up
to the implementation or the optimization an XProc procecssor might perform.

I have run some simple tests with p:json-merge (creating a map
containing two instances of an XML document) and p:json-join (creating
an array of two instances of an XML document) and a simple p:xquery
returning also an array of two instances of an XML document.

For the two JSON steps it seems MorganaXProc-III preserves the identity
of the XML document node if I pass in the same source document twice,
for the XQuery step that doesn't seem to happen.

So for

     <p:json-join>
         <p:with-input port="source"
pipe="source@json-join-identity-test source@json-join-identity-test"/>
     </p:json-join>
     <p:identity message="{.(1) is .(2)}"/>

and

     <p:json-merge>
         <p:with-input port="source"
pipe="source@json-merge-identity-test source@json-merge-identity-test"/>
     </p:json-merge>
     <p:identity message="{.('_1') is .('_2')}"/>

the "message" on the p:identity step outputs "true" while for

     <p:xquery>
         <p:with-input port="source" pipe="source@xquery-identity-test"/>
         <p:with-option name="parameters" select="map { 'doc2' : . }">
             <p:pipe port="source" step="xquery-identity-test"/>
         </p:with-option>
         <p:with-input port="query">
             <c:query>
                 declare variable $doc2 as document-node() external;
                 [., $doc2]
             </c:query>
         </p:with-input>
     </p:xquery>
     <p:identity message="{.(1) is .(2)}"/>

it outputs "false".

What are your thoughts, is the preservation of node identity an
implementation detail?

And in the case of MorganaXProcIII the above difference is caused by the
use of Saxon for the p:xquery step while the p:json-join and
p:json-merge are part of the "native" XDM implementation of the XProc
processor?

In the end keeping two instances of the same input is not really
interesting but I was taking that as a simple starting point to some
tests; in reality with XQuery 3.1 or XSLT 3 I like to use an array of
arrays of nodes or an array of sequences of nodes as the light-weight
result of a grouping operation and I was curious whether any such result
would preserve the identity of the nodes in the arrays if I pass it on.
Received on Tuesday, 3 March 2020 10:13:29 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 3 March 2020 10:13:30 UTC