[xsl] Selecting Nodes by nodeset comparison

Subject: [xsl] Selecting Nodes by nodeset comparison
From: <michella@xxxxxxx>
Date: Tue, 12 Apr 2005 13:38:00 +0200
Hello,

Unfortunately, I have a newbie question.

Given two xml data.
Each contain the same data structure.
I would like to select nodes from both of them which might fit an Xpath
condition (some attributes from xml1/nodes should be equal to attributes from
xml2/nodes).
Then I would like to select all other nodes that did not match the condition.

<xsl:variable name="input_IT_Stunde"
select="document(concat('../temp/stunde_',$Property_File/Vergleichseigenschaf
ten/Input[@Sortierungsart='Maschine']/@Input_XML,'.xml'))/EintrdgeListe"/>
<xsl:variable name="input_Manual_Stunde"
select="document(concat('../temp/stunde_',$Property_File/Vergleichseigenschaf
ten/Input[@Sortierungsart='Hand']/@Input_XML,'.xml'))/EintrdgeListe"/>

Is the following Xpath correct?

<xsl:variable name="matching_IT-Man"
	select="$input_IT_Stunde/Eintrag[@Datum=$input_Manual_Stunde/Eintrag/@BZ_Abg
angsdatum and
substring(@Zeit,1,2)=substring($input_Manual_Stunde/Eintrag/@BZ_Zeit,1,2) and
@Geographisch=$input_Manual_Stunde/Eintrag/@BZ_Geographisch and
@BBZ_Nummer=$input_Manual_Stunde/Eintrag/@BZ_BBZ_Nummer and @Leistungsangebot=
$input_Manual_Stunde/Eintrag/@BZ_DLA and
@Verarbeitungsart=$input_Manual_Stunde/Eintrag/@BZ_Verarbeitung  and
@Format=$input_Manual_Stunde/Eintrag/@BZ_Format and
@Zustellart=$input_Manual_Tage/Eintrag/@BZ_Zustellart]"
/>
... for each $matching_IT-Man, do....

THEN : (Same Xpath condition as  the first one, but with a negation not()
<xsl:variable name="NOT_matching_IT-Man"
	select="$input_IT_Stunde/Eintrag[not(@Datum=$input_Manual_Stunde/Eintrag/@BZ
_Abgangsdatum and
substring(@Zeit,1,2)=substring($input_Manual_Stunde/Eintrag/@BZ_Zeit,1,2) 	and
@Geographisch=$input_Manual_Stunde/Eintrag/@BZ_Geographisch and
@BBZ_Nummer=$input_Manual_Stunde/Eintrag/@BZ_BBZ_Nummer and @Leistungsangebot=
$input_Manual_Stunde/Eintrag/@BZ_DLA and
@Verarbeitungsart=$input_Manual_Stunde/Eintrag/@BZ_Verarbeitung  and
@Format=$input_Manual_Stunde/Eintrag/@BZ_Format and
@Zustellart=$input_Manual_Tage/Eintrag/@BZ_Zustellart)]"
/>
... for each $NOT_matching_IT-Man, do....

The final result shoud be the whole XML1 input data.

Why I ask such a question is due to the fact that when I add all values
contained within one specific attribute, the resulting sum isn't equal to the
one of the main XML1 attributes.

Thanks for your help

Lawrence Michel

Current Thread