Dear Wolfhart,
You may find
http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html useful.
Best,
David
On Sun, Jan 19, 2020 at 3:36 PM Wolfhart Totschnig
wolfhart(_dot_)totschnig(_at_)mail(_dot_)udp(_dot_)cl
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
wrote:
Hello,
I have an XSL/XPath problem to which I cannot find the solution. I have
an xml file with data about films, in the following form (simplified):
<film>
<title>The big Lebowski</title>
<director>
<first>Joel</first>
<last>Coen</last>
</director>
<director>
<first>Ethan</first>
<last>Coen</last>
</director>
<author>
<first>Ethan</first>
<last>Coen</last>
</author>
<author>
<first>Joel</first>
<last>Coen</last>
</author>
</film>
I would like to test whether the director(s) of the film are the same as
its writer(s) (here called "authors"). That is, I want to test whether
for each <director> element there is an <author> element with the same
child elements, and vice versa (i.e., for each <author> element a
corresponding <director> element). So, in the above case, the test
should return <true>. Note that the order of the <director>/<author>
elements should not matter. By contrast, in the following example the
test should return <false>:
<film>
<title>M</title>
<director>
<first>Fritz</first>
<last>Lang</last>
</director>
<author>
<first>Thea von</first>
<last>Harbou</last>
</author>
<author>
<first>Fritz</first>
<last>Lang</last>
</author>
</film>
How can this be done?
To explain the purpose of this: When the test comes out true, the output
will be "Written and directed by [names]", whereas otherwise it will be
"Written by [names]. Directed by [names]".
Thanks in advance for your help!
Wolfhart
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--