xsl-list
[Top] [All Lists]

Re: [xsl] filter using contains with multiple values

2016-03-03 12:31:41
Raimund Kammering raimund(_dot_)kammering(_at_)desy(_dot_)de wrote:
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 ‘some’ after the ‘and’:

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

Sorry, the expression needs parenthesis

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


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

If you want a comparison with "=" then you can simply use

  <xsl:if test="*[name()= $filter and . = $filter_values]">

as the "=" comparison between a value and a sequence is true if there is at least one item in the sequence that is equal to the value. The `some` expression is only needed if you want the contains check.
--~----------------------------------------------------------------
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>