A simple way to do this:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="/*/file1/*/*/client">
<xsl:if test="not(../@cat = /*/file2/*/*/client[number =
current()/number]/../@cat)">
<xsl:copy-of select=". | /*/file2/*/*/client[number =
current()/number]" />
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
when this transformation is applied on this source.xml (I combined the two
files in one for convenience -- you'll have to use document()):
<files>
<file1>
<root>
<clients cat="corp">
<client>
<number>0098</number>
<lastname>Smith</lastname>
<frstname>John</frstname>
<email>1@1.1</email>
</client>
<client>
<number>0067</number>
<lastname>Carter</lastname>
<frstname>Gary</frstname>
<email>2@2.2</email>
</client>
</clients>
<clients cat="prvt">
<client>
<number>0076</number>
<lastname>Lavigne</lastname>
<frstname>Avril</frstname>
<email>3@3.3</email>
</client>
<client>
<number>0055</number>
<lastname>Donnely</lastname>
<frstname>Al</frstname>
<email>4@4.4</email>
</client>
</clients>
</root>
</file1>
<file2>
<root>
<clients cat="corp">
<client>
<number>0098</number>
<lastname>Smith</lastname>
<frstname>John</frstname>
<email>1@1.1</email>
</client>
</clients>
<clients cat="prvt">
<client>
<number>0076</number>
<lastname>Lavigne</lastname>
<frstname>Avril</frstname>
<email>3@3.3</email>
</client>
<client>
<number>0055</number>
<lastname>Donnely</lastname>
<frstname>Al</frstname>
<email>4@4.4</email>
</client>
<client>
<number>0067</number>
<lastname>Carter</lastname>
<frstname>Gary</frstname>
<email>2@2.2</email>
</client>
</clients>
</root>
</file2>
</files>
the wanted result is produced:
<client>
<number>0067</number>
<lastname>Carter</lastname>
<frstname>Gary</frstname>
<email>2@2.2</email>
</client>
<client>
<number>0067</number>
<lastname>Carter</lastname>
<frstname>Gary</frstname>
<email>2@2.2</email>
</client>
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Frank" <francoisplourde@yahoo.com> wrote in message
news:236d7175.0309111653.312e6bab@posting.google.c om...[color=blue]
> Hi, is there a way to use XSL to compare two XML files to verify if a
> "record"
> in an XML file has changed of parent in another XML file ?
>
> I am trying to implement a template in an XSL stylesheet that would be[/color]
able[color=blue]
> to compare the two files below
> and indicate if a client has changed of category (ex.: from "corp" to
> "prvt").
>
> Any help would be gladly appreciated, I am desparatly trying to find a
> solution to this.
>
> In the above example, client number 0067 has changed
> from "corp" (in file1.xml) to "prvt" (in file2.xml).
>
> file1.xml:
> -----------
>
> <root>
> <clients cat="corp">
> <client>
> <number>0098</number>
> <lastname>Smith</lastname>
> <frstname>John</frstname>
> <email>1@1.1</email>
> </client>
> <client>
> <number>0067</number>
> <lastname>Carter</lastname>
> <frstname>Gary</frstname>
> <email>2@2.2</email>
> </client>
> </clients>
> <clients cat="prvt">
> <client>
> <number>0076</number>
> <lastname>Lavigne</lastname>
> <frstname>Avril</frstname>
> <email>3@3.3</email>
> </client>
> <client>
> <number>0055</number>
> <lastname>Donnely</lastname>
> <frstname>Al</frstname>
> <email>4@4.4</email>
> </client>
> </clients>
> </root>
>
> file2.xml:
> -----------
>
> <root>
> <clients cat="corp">
> <client>
> <number>0098</number>
> <lastname>Smith</lastname>
> <frstname>John</frstname>
> <email>1@1.1</email>
> </client>
> </clients>
> <clients cat="prvt">
> <client>
> <number>0076</number>
> <lastname>Lavigne</lastname>
> <frstname>Avril</frstname>
> <email>3@3.3</email>
> </client>
> <client>
> <number>0055</number>
> <lastname>Donnely</lastname>
> <frstname>Al</frstname>
> <email>4@4.4</email>
> </client>
> <client>
> <number>0067</number>
> <lastname>Carter</lastname>
> <frstname>Gary</frstname>
> <email>2@2.2</email>
> </client>
> </clients>
> </root>
>
> THANKS![/color]