Subject: AW: Selecting Nodes by nodeset comparison
From: <michella@xxxxxxx>
Date: Tue, 12 Apr 2005 14:36:37 +0200
|
Here is a better explanation of my problematic :
XML1 :
<EintrdgeListe>
<Eintrag Datum="20050212" Zeit="0800" Menge="64"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="36"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="22"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="2"/>
</EintrdgeListe>
XML2 :
<EintrdgeListe>
<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0800" BZF_MengeGezdhlt="147"/>
<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0800" BZF_MengeGezdhlt="50"/>
<Eintrag BZ_Abgangsdatum="20050212" BZ_Zeit="0800" BZF_MengeGezdhlt="49"/>
<Eintrag BZ_Abgangsdatum="20050213" BZ_Zeit="0800" BZF_MengeGezdhlt="37"/>
</EintrdgeListe>
-----------
Is the following Xpath correct?
<xsl:variable
name="matching_XML1"
select="$XML1/Eintrag[@Datum=XML2/Eintrag/@BZ_Abgangsdatum and
substring(@Zeit,1,2)=substring($XML2/Eintrag/@BZ_Zeit,1,2)]"
/>
... for each $matching_IT-Man, add a copy of those nodes to output....
--> Selected should be (from XML1):
<Eintrag Datum="20050212" Zeit="0800" Menge="64"/>
THEN : (Same Xpath condition as the first one, but with a negation not()
<xsl:variable
name="NOT_matching_XML1"
select="$XML1/Eintrag[not(@Datum=$XML2/Eintrag/@BZ_Abgangsdatum and
substring(@Zeit,1,2)=substring($XML2/Eintrag/@BZ_Zeit,1,2))]"
/>
... for each $NOT_matching_IT-Man, add a copy of those nodes to output....
--> Selected should be (from XML1):
<Eintrag Datum="20050214" Zeit="0800" Menge="36"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="22"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="2"/>
----------------------
The final result shoud be the whole XML1 input data.
<Eintrag Datum="20050212" Zeit="0800" Menge="64"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="36"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="22"/>
<Eintrag Datum="20050214" Zeit="0800" Menge="2"/>
I hope this help
Thanks for your help
Lawrence Michel
|