Re: [xsl] Selecting elements from source document based on matches to a second document

Subject: Re: [xsl] Selecting elements from source document based on matches to a second document
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 6 Mar 2023 08:45:27 -0000
> So, given
> <xsl:variable name-"paths-to-match" as="xs:string*"
>  select="doc('checkpaths.xml')/checkpaths/path" />
>
> you can use
> /log/logentry[paths/path = $paths=to-match]
>
> This is O(nB2) on the number of paths,

Not if you use a processor that does join optimisation!

But if you don't want to rely on the system's optimizer, it's easy enough to
hand-optimize with

<xsl:key name="k" match="/log/logentry" use="paths/path"/>

... select="key('k', $paths-to-match)"

Michael Kay
Saxonica

Current Thread