Re: [xsl] XPath shorthand

Subject: Re: [xsl] XPath shorthand
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 22 Aug 2012 15:02:44 +0100
>> <xsl:variable name="names" select="('m__id', 'm__name',
>> 'm__path'....)" as="xs:string+"/>
>>
>> with
>>
>> following-sibling::*[local-name() = $names]
>>
>
> Yes I didn't think of this but there are two things.
>
> This won't work in a template match on XSLT 1.0 and it is hiding
> multiple comparisons under the innocent looking equality general
> comparison which may bite on large volumes.

Ok that wasn't in the reqs... I just rewrote your code snippet.  An
xslt 1.0/2.0 alternative is:

<xsl:apply-templates select="following-sibling::*" mode="my-filter"/>

<xsl:template match="foo | bar | baz" mode="my-filter"/>

> Unfortunately I don't have the volume of data to benchmark the keys
> solution vs the variable solution.

you could create some with xslt : )

>  I presume your preference for variables is based on better
> performances (at least until volumes start to get large).

Not really...  the key technique just seems a bit odd.



-- 
Andrew Welch
http://andrewjwelch.com

Current Thread