Re: [xsl] comparing nodesets to each other

Subject: Re: [xsl] comparing nodesets to each other
From: "Kai Hackemesser" <kaha@xxxxxx>
Date: Mon, 11 Apr 2005 18:18:47 +0200 (MEST)
Hello, David,

Thanks for the response. The errors you mentioned already have happened,
that's why I'm currently clueless how to solve it.

I try to show the structure of the recipe (eased):

<object>
  <relation>
    <Attribute Type="string" Name="FindNumber">
      <Value><![CDATA[0005]]></Value>
    <Attribute>
    <Attribute Type="float" Name="... 
    <object>
      <Attribute Type="string" Name="PartNumber">
        <Value><![CDATA[Part1]]></Value>
      </Attribute>
    </object>
  </relation>
  <relation>
    <Attribute Type="string" Name="FindNumber">
      <Value><![CDATA[0010]]></Value>
    <Attribute>
    <Attribute Type="float" Name="... 
    <object>
      <Attribute Type="string" Name="PartNumber">
        <Value><![CDATA[Part2]]></Value>
      </Attribute>
    </object>
  </relation>
  <relation>
    <Attribute Type="string" Name="FindNumber">
      <Value><![CDATA[0015]]></Value>
    <Attribute>
    <Attribute Type="float" Name="... 
    <object>
      <Attribute Type="string" Name="PartNumber">
        <Value><![CDATA[Part3]]></Value>
      </Attribute>
    </object>
  </relation>
</object>         

needs to be compared against a similar structure:
<object>
  <relation>
    <Attribute Type="string" Name="FindNumber">
      <Value><![CDATA[0005]]></Value>
    <Attribute>
    <Attribute Type="float" Name="... 
    <object>
      <Attribute Type="string" Name="PartNumber">
        <Value><![CDATA[Part1]]></Value>
      </Attribute>
    </object>
  </relation>
  <relation>
    <Attribute Type="string" Name="FindNumber">
      <Value><![CDATA[0015]]></Value>
    <Attribute>
    <Attribute Type="float" Name="... 
    <object>
      <Attribute Type="string" Name="PartNumber">
        <Value><![CDATA[Part3b]]></Value>
      </Attribute>
    </object>
  </relation>
</object>         

(Attribute nodes are more than one per object or relation node)

So I need to extract all differences like attribute change, missing nodes,
altered nodes, added nodes. To identify a node I use the findnumber
Attribute node of each relation node. A missing node is one, where the
corresponding Findnumber Attribute value is missing in nodelist 'b'. An
added node is one where the corresponding Findnumber Attribute value is
missing in nodelist 'a'. An altered node means the Findnumber Attribute
value is there in bothe nodelists, but the Attribute nodes or the
object/Attribute nodes are different. I think a simple text compare would be
enough for the test of alternation.

Regards,
Kai

Current Thread