Re: [xsl] filter using contains with multiple values

Subject: Re: [xsl] filter using contains with multiple values
From: "Raimund Kammering raimund.kammering@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 3 Mar 2016 18:25:14 -0000
Great this was exactly what I was looking for, BUT it does not work for me!
There seam to be two problems:

1. Saxon complains about bsomeb after the bandb:

  XPST0003: XPath syntax error at char 21 on line 279 in {*[name()=$filter and
some $}:
    Unexpected token "some" in path expression

but here I get out using this much better syntax suggested by Michael Kay:

test="*[name()=$filter][. = $filter_value]b

2. so if I sum up these both tips, I end up with:

test="*[name()=$filter][some $value in $filter_value satisfies .=$value]b

which works correctly for filter_value holding only one string like:

<xsl:param name="filter_values" as="xs:string*" select=bLogb/>

but does not match any of them if filter_value holds e.g. two values:

<xsl:param name="filter_values" as="xs:string*" select="'Log', 'Info'b/>

So I guess Ibm missing some concept on how to work with a batomicb type
as xs:string is to have the bsome in satisfiesb
properly iterate over it!?


> On 02 Mar 2016, at 19:54, Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Raimund Kammering raimund.kammering@xxxxxxx wrote:
>> I would like to allow to pass in a flexile number of values for the
bfilter_valueb, like bLogb or bInfob to match the first two plus
>> last entry. I guess the solution would be to do this in kind of a loop, but
how can this be done with bfilter_valueb being a
>> simple XSL variable or is exactly this the weakness of the approach?
>> Ibrunning Saxon version: so that Ibm able to use XSLT and XPath
> You can use
>  <xsl:if test="*[name()=$filter and some $value in $filter_values satisfies
contains(., $value)]b>
> where you define <xsl:param name="filter_values" as="xs:string*"
select="'Log', 'Info'"/>.

Current Thread