## Re: [saxon] Deep compare of two elements

 Re: [saxon] Deep compare of two elements From: Michael Kay - 2010-03-22 22:59:08 Attachments: Message as HTML ```The deep-equal() function would appear to do what you need. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay _____ From: Vanfleet, David [mailto:david.vanfleet@...] Sent: 22 March 2010 22:06 To: saxon-help@... Subject: [saxon] Deep compare of two elements Hi, I need to be able to do a deep compare two elements structures to determine if they are the same. For the elements to be the same they need to: . Contain the same element names in the same order . Contain the same element values . Contain the same attribute values For example if I have the following 3 nodes: pac1 ver1 pac1 pac1 ver1 I need to determine that: \$node1 is NOT equal to \$node2 And \$node1 IS equal to \$node3 I know that I can write a function that can manually check all of these values but my element structure can get much more complicated then what I'm showing in my examples so I would like to know if there is an easier way to do this. I have looked at the <> and <<=>> operators but they don't give me what I need. Any help would be greatly appreciated. Regards, David ```

 [saxon] Deep compare of two elements From: Vanfleet, David - 2010-03-22 22:18:19 Attachments: Message as HTML ```Hi, I need to be able to do a deep compare two elements structures to determine if they are the same. For the elements to be the same they need to: * Contain the same element names in the same order * Contain the same element values * Contain the same attribute values For example if I have the following 3 nodes: pac1 ver1 pac1 pac1 ver1 I need to determine that: \$node1 is NOT equal to \$node2 And \$node1 IS equal to \$node3 I know that I can write a function that can manually check all of these values but my element structure can get much more complicated then what I'm showing in my examples so I would like to know if there is an easier way to do this. I have looked at the <> and <<=>> operators but they don't give me what I need. Any help would be greatly appreciated. Regards, David ```
 Re: [saxon] Deep compare of two elements From: Michael Kay - 2010-03-22 22:59:08 Attachments: Message as HTML ```The deep-equal() function would appear to do what you need. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay _____ From: Vanfleet, David [mailto:david.vanfleet@...] Sent: 22 March 2010 22:06 To: saxon-help@... Subject: [saxon] Deep compare of two elements Hi, I need to be able to do a deep compare two elements structures to determine if they are the same. For the elements to be the same they need to: . Contain the same element names in the same order . Contain the same element values . Contain the same attribute values For example if I have the following 3 nodes: pac1 ver1 pac1 pac1 ver1 I need to determine that: \$node1 is NOT equal to \$node2 And \$node1 IS equal to \$node3 I know that I can write a function that can manually check all of these values but my element structure can get much more complicated then what I'm showing in my examples so I would like to know if there is an easier way to do this. I have looked at the <> and <<=>> operators but they don't give me what I need. Any help would be greatly appreciated. Regards, David ```
 Re: [saxon] Deep compare of two elements From: Vanfleet, David - 2010-03-23 14:27:50 Attachments: Message as HTML ```Yes, deep-equal() is exactly what I needed, thank you very much! Regards, David -----Original Message----- From: Andrew Welch [mailto:andrew.j.welch@...] Sent: Tuesday, March 23, 2010 2:23 AM To: Mailing list for the SAXON XSLT and XQuery processor Subject: Re: [saxon] Deep compare of two elements have a look at "deep-equal()" it does exactly what you want... http://www.w3.org/TR/xpath-functions/#func-deep-equal From: Michael Kay [mailto:mike@...] Sent: Monday, March 22, 2010 4:59 PM To: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: [saxon] Deep compare of two elements The deep-equal() function would appear to do what you need. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay ________________________________ From: Vanfleet, David [mailto:david.vanfleet@...] Sent: 22 March 2010 22:06 To: saxon-help@... Subject: [saxon] Deep compare of two elements Hi, I need to be able to do a deep compare two elements structures to determine if they are the same. For the elements to be the same they need to: * Contain the same element names in the same order * Contain the same element values * Contain the same attribute values For example if I have the following 3 nodes: pac1 ver1 pac1 pac1 ver1 I need to determine that: \$node1 is NOT equal to \$node2 And \$node1 IS equal to \$node3 I know that I can write a function that can manually check all of these values but my element structure can get much more complicated then what I'm showing in my examples so I would like to know if there is an easier way to do this. I have looked at the <> and <<=>> operators but they don't give me what I need. Any help would be greatly appreciated. Regards, David ```
 Re: [saxon] Deep compare of two elements From: Andrew Welch - 2010-03-23 08:22:55 ```have a look at "deep-equal()" it does exactly what you want... http://www.w3.org/TR/xpath-functions/#func-deep-equal On 22 March 2010 22:05, Vanfleet, David wrote: > Hi, I need to be able to do a deep compare two elements structures to > determine if they are the same. For the elements to be the same they need > to: > > > > ·         Contain the same element names in the same order > > ·         Contain the same element values > > ·         Contain the same attribute values > > > > For example if I have the following 3 nodes: > > > > > > > > pac1 > > ver1 > > > > > > > > > > pac1 > > > > > > > > > > pac1 > > ver1 > > > > > > I need to determine that: > > > >                 \$node1 is NOT equal to \$node2 > > > > And > > > > \$node1 IS equal to \$node3 > > > > I know that I can write a function that can manually check all of these > values but my element structure can get much more complicated then what I’m > showing in my examples so I would like to know if there is an easier way to > do this. I have looked at the <> and <<=>> operators but they don’t give > me what I need. Any help would be greatly appreciated. > > > > Regards, > > David > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help > -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ ```