xsl-list
[Top] [All Lists]

Re: [xsl] filter using contains with multiple values

2016-03-02 12:53:47
Raimund Kammering raimund(_dot_)kammering(_at_)desy(_dot_)de wrote:

I would like to allow to pass in a flexile number of values for the ‘filter_value’, like 
‘Log’ or ‘Info’ to match the first two plus the
last entry. I guess the solution would be to do this in kind of a loop, but how can this be 
done with ‘filter_value’ being a
simple XSL variable or is exactly this the weakness of the approach?

I’running Saxon version: 9.1.0.8 so that I’m able to use XSLT and XPath 2.0.

You can use

<xsl:if test="*[name()=$filter and some $value in $filter_values satisfies contains(., $value)]”>

where you define <xsl:param name="filter_values" as="xs:string*" select="'Log', 'Info'"/>.

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