W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > May 2007

Re: p:equals proposal

From: Norman Walsh <ndw@nwalsh.com>
Date: Sat, 26 May 2007 09:17:21 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <87fy5jiv1a.fsf@nwalsh.com>
/ Innovimax SARL <innovimax@gmail.com> was heard to say:
| We have p:identity to output the identity as its output
|
| In some case, I need to make comparison between outputs to know if
| they are equals

Yes, I've already implemented an "equal" step for this purpose, though
I did it as an example of an extension step.

<p:declare-step type="px:equal">
  <p:input port="doca" sequence="no"/>
  <p:input port="docb" sequence="no"/>
  <p:output port="result" sequence="no"/>
  <p:option name="fail-if-different" value="no"/>
</p:declare-step>

It produces

<c:result>0</c:result> or <c:result>1</c:result> to indicate if they're
different or the same, respectively.

| == document version ==
| <p:equal>
| <p:input port="source">
| <p:input port="compare-to">

Those are better names than mine, certainly.

| <p:output port="result">
| <p:output port="alternate"/>

I don't think there's any reason to give various components identity
semantics. The inputs are already available from wherever the equal
step read them. What's more, if they pass through the equal component
then the implementation can't run whatever the other steps are in
parallel with the equal step.

| <p:export-option name="is-equal"/><!-- type boolean() -->
| <p:export-option name="xpath-position"/><!-- type string() -->

No! :-)

| If would do a sequential node by node comparaison.

I think the right thing to do is say that it performs the XPath 2.0
"deep-equal" algorithm. I don't want to invent a new, different
semantic.

| And it would make available the first position in document order where
| the document differs as a simple xpath (of the form
| doc[1]/div[2]/p[3]/a[1])

I could be talked into this, maybe, but I'm not initially in-favor.
It might be quite hard to calculate and wouldn't allow implementors
to rely on existing implementations of deep-equals.

| == sequence version ==
| (we need only one of those)

Can we have none? You have for-each if you want to do a sequence of
comparisons.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | A man may by custom fortify himself
http://nwalsh.com/            | against pain, shame, and suchlike
                              | accidents; but as to death, we can
                              | experience it but once, and are all
                              | apprentices when we come to it.--
                              | Montaigne

Received on Saturday, 26 May 2007 13:17:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:52 GMT