Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: data set operation - remove nodes from one data set that have nodes that exist in another data set [Thread Next] Re: data set operation - remove nodes from one data set that have nodes that exist in another data setTo: NULL Date: 7/27/2008 1:09:00 PM On Jul 27, 12:47=A0pm, Martin Honnen <mahotr...@yahoo.de> wrote: > vanSkier wrote: > > SOURCE DATA > > ----------- > > > <datasets> > > > =A0 =A0 =A0<dataset set=3D"1"> > > =A0 =A0<data>Company 1</data> > > =A0 =A0<data>Company 2</data> > > =A0 =A0<data>Company 3</data> > > =A0 =A0<data>Company 4</data> > > =A0 =A0<data>Company 5</data> > > =A0 =A0 =A0</dataset> > > > =A0 =A0 =A0<dataset set=3D"2"> > > =A0 =A0<data>Company 1</data> > > =A0 =A0<data>Company 2</data> > > =A0 =A0<data>Company 5</data> > > =A0 =A0 =A0</dataset> > > > </datasets> > > > RESULT DATA > > ----------- > > > <datasets> > > > =A0 =A0 =A0<dataset set=3D"result"> > > =A0 =A0<data>Company 3</data> > > =A0 =A0<data>Company 4</data> > > =A0 =A0 =A0</dataset> > > > </datasets> > > Here is an XSLT stylesheet that produces the described result: > > <xsl:stylesheet > =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform" > =A0 =A0version=3D"1.0"> > > =A0 =A0<xsl:output method=3D"xml" indent=3D"yes"/> > > =A0 =A0<xsl:template match=3D"datasets"> > =A0 =A0 =A0<xsl:copy> > =A0 =A0 =A0 =A0<dataset set=3D"result"> > =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"dataset[@set =3D '1']/data[not(= . =3D > /datasets/dataset[@set =3D '2']/data)]"/> > =A0 =A0 =A0 =A0</dataset> > =A0 =A0 =A0</xsl:copy> > =A0 =A0</xsl:template> > > </xsl:stylesheet> > > -- > > =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML > =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/ Thank you very much Martin, I knew there had to be an elegant alternative to the brute force approach that I was hatching. Rod | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
