Subject: Re: [xsl] compare two node sets From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 21 Jan 2020 16:39:27 -0000 |
On 21.01.2020 17:34, Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx wrote:
Thank you for your solution. I have a question about it, which has to do with the fact that, in my case, the <author>/<director> elements also may have a <middle> child element, which I did not mention in my original post. Now, if I understand correctly, your solution does not differentiate between
B B B B B B B <director> B B B B B B B B B B <first>J.</first> B B B B B B B B B B <middle>R.</first> B B B B B B B B B B <last>Doe</last> B B B B B B B </director>
and
B B B B B B B <director> B B B B B B B B B B <first>J. R.</first> B B B B B B B B B B <last>Doe</last> B B B B B B B </director>
Is that right? (I am not saying that this is necessarily a problem. It may even be seen as a feature rather than a bug. I just want to be sure that I understand the solution correctly.)
I guess first you would need to adapt the function to select all three elements e.g. string-join($who/(first, middle, last), ' ') or string-join($who/*, ' ')
But you are right that it couldn't distinguish your two inputs although of course using a different second argument to string-join like '|' instead of the space would allow that.
On 21.01.20 12:42, Piez, Wendell A. (Fed) wendell.piez@xxxxxxxx wrote:Hi,
Another solution not yet suggested in this thread is to avoid deep-equal() and rely on a signature function.
So for example,
<xsl:function name="f:signature" as="xs:string"> B B <xsl:param name="who" as="node()"/> B B <xsl:value-of select="string-join($who/(first, last), ' ')"/> </xsl:function>
Then your list of author-directors is //author[f:signature(.)=parent::film/child::director/f:signature(.)]
(Or the other way around.)
Wrap the expression in the filter in not() to retrieve authors who did not direct, etc.
One advantage of this approach is it's easy to adjust the signature logic to real-world exigencies.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] compare two node sets, Wolfhart Totschnig w | Thread | Re: [xsl] compare two node sets, Piez, Wendell A. (Fe |
Re: [xsl] compare two node sets, Wolfhart Totschnig w | Date | Re: [xsl] compare two node sets, Liam R. E. Quin liam |
Month |