xsl-list
[Top] [All Lists]

Re: [xsl] compare two node sets

2020-01-19 15:21:21
Thank you, David, Michael, and Liam for the prompt replies! Michael's solution seems to be the simplest to implement. I use Saxon 9 HE, so XPath 2.0 should be okay. And, indeed, quadratic performance should not be an issue. However, Saxon throws the following error:

XPST0003: Unexpected token "every" at start of expression

Is there a typo in the expression? I used the expression as given:

<xsl:when test="count(//director) eq count(//author) and every $d in //director satisfies some $a in //author satisfies deep-equal($d/*, $a/*)">

To clarify, the context node is the <film> element.

Wolfhart


On 19.01.20 17:55, Liam R. E. Quin liam(_at_)fromoldbooks(_dot_)org wrote:
On Sun, 2020-01-19 at 20:37 +0000, Wolfhart Totschnig
wolfhart(_dot_)totschnig(_at_)mail(_dot_)udp(_dot_)cl 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):

[..]
. 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>
Why?

As stated,
  <xsl:mode on-no-match="shallow-copy" />

   <xsl:template match="/">
     <xsl:apply-templates select="/films/film[
         some $a in author satisfies
         (
             ($a/first = director/first)
             and ($a/last = director/last)
         )
     ]"/>
   </xsl:template>

Liam

--~----------------------------------------------------------------
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
--~--

<Prev in Thread] Current Thread [Next in Thread>