xsl-list
[Top] [All Lists]

Re: [xsl] filter using contains with multiple values

2016-03-03 13:21:12
On Thu, Mar 03, 2016 at 07:00:49PM -0000, Raimund Kammering
raimund(_dot_)kammering(_at_)desy(_dot_)de scripsit:
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!?

You may be having trouble from the other side; . is the context value,
and will be understood as the string value of the element found by the
match, and that might not be what you expect.  It's pretty easy to get
some white space in there, for example, and = is an exact match. (You
won't, for example, match "info" with that filter value.)

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

is what I'd expect for explicitly creating a sequence.

<xsl:sequence select="$filter_value[2], $filter_value[1]"/>

Should show you whether or not you've really got a sequence;
<xsl:value-of/> creates a text node, which isn't what you want because
various rules about turning the sequence into text come into play.

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