Re: [xsl] Seek your recommendation on how to report differences in two <row> element sequences

Subject: Re: [xsl] Seek your recommendation on how to report differences in two <row> element sequences
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Nov 2024 16:59:36 -0000
> Question: how do you recommend reporting differences between two <row>
element sequences?

You will have to do what deep-equal() is doing, and report the first found
difference. Optionally, you may continue the comparison and report **all**
found differences.

Another, maybe simpler way, is to produce the **normalized** serialization
of the two nodes (or the two sequences) that are to be compared, and
compare these two serializations as strings.

Thanks,
Dimitre.


On Fri, Nov 15, 2024 at 6:14b/AM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> What does it mean to compare two sequences of <row> elements, where each
> <row> element has (leaf) child elements?
>
> Suppose sequence #1 has this <row> element:
>
>     <row>
>         <DESC>-</DESC>
>     </row>
>
> If there is no <row> in sequence #2 containing one child element named
> DESC and value '-' then report that the <row> element is in sequence #1 and
> not in sequence #2.
>
> Suppose sequence #2 has this <row> element:
>
>     <row>
>         <DESC>-</DESC>
>         <DESCRIPTION>AT OR BELOW ALTITUDE</DESCRIPTION>
>     </row>
>
> Should I report that the <row> element in sequence #1 is not in sequence
> #2?
>
> Suppose sequence #1 has this <row> element:
>
>     <row>
>         <NAME>GENERAL EDWARD LAWRENCE LOGAN INTL</NAME>
>         <ICAO>KBOS</ICAO>
>         <WGS_LAT>N42214660</WGSLAT>
>         <WGS_LONG>W071002300</WGS_LONG>
>         <ELEV>00019</ELEV>
>     </row>
>
> And sequence #2 has this <row> element:
>
>     <row>
>         <NAME>GENERAL EDWARD LAWRENCE LOGAN INTL</NAME>
>         <ICAO>KBOS</ICAO>
>         <WGS_LAT>N42214660</WGSLAT>
>         <WGS_LONG>W071002300</WGS_LONG>
>         <ELEV>00018</ELEV>
>     </row>
>
> The ELEV values differ.
>
> I could report that the <row> element in sequence #1 is not in sequence #2
> but that would be disingenuous because there is a <row> element in sequence
> #2 about LOGAN airport. It seems that reporting differences at the <row>
> element level is bad, especially when there are many child elements, most
> of which have the same values.
>
> Should I report differences at the child element level? How to do this in
> a meaningful and succinct way?
>
> "In sequence #1 the <row> element for LOGAN airport differs from the
> sequence #2 <row> element for LOGAN airport in the <ELEV> element."
>
> That looks good, except I hand-crafted it; auto generating a meaningful
> report would be difficult.
>
> Question: how do you recommend reporting differences between two <row>
> element sequences?
>
> /Roger

Current Thread