xsl-list
[Top] [All Lists]

Re: [xsl] filter using contains with multiple values

2016-03-03 13:00:47
okay got that point (parenthesis). But still that does not work for me since 
somehow the string in filter_value is not understood as sequence!
So if I now use:

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

or as Michael suggested

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

it only matches the first of the two in the sequence if I use

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

to pass the parameter! Even an:

<xsl:value-of select=“$filter_value”/>

only returns: ‘Log’ where I would expect it to return the whole parameter! I 
seem to still miss some crucial point in making filter_value being understood 
as sequence here!?

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>