Re: Re: [xsl] Thought i knew this but i guess not

Subject: Re: Re: [xsl] Thought i knew this but i guess not
From: Chris Maloney <voldrani@xxxxxxxxx>
Date: Tue, 22 Feb 2011 22:45:47 -0500
I guess, it's not that hard.  You can have commas and spaces in any
combination.
How about this, assuming you're looking for $wantFilter:

contains( concat( normalize-space( translate( @filter, ",", " " ) ), "
" ), concat( $wantFilter, " " ) )

Russ, here are the steps:
- First translate all commas to spaces
- Then normalize-space -- look up that function if you don't know what
it does.  If all you have are spaces (and no tabs, for example) then
you can skip this.
- Add a space to the end, just for good measure
- Also add a space to the end of the thing you're looking for.  This
prevents "filter1" from matching "filter11".
- Then see if there's a match.


On Tue, Feb 22, 2011 at 10:12 PM, Liam R E Quin <liam@xxxxxx> wrote:
> On Tue, 2011-02-22 at 21:22 -0500, Chris Maloney wrote:
>> On Tue, Feb 22, 2011 at 6:54 PM, Liam R E Quin <liam@xxxxxx> wrote:
>
>> > You want contains(concat(",", @filter, ","), ",filter1,") probably.
>>
>> Sorry to be kind of didactic here, but it won't work -- if you look at
>> the example he gave earlier:
>
>> > The filter value can be of a form filter="filter1,filter10, filter17,
filter23" something like that, so i need to do a little more testing.
>
>> he's got spaces and commas, at random -- it's a mess.
>
> Ugh, you are right. Although that might just be in an example for
> xml-dev, just as "filter17" might really be "wears-dark-socks" for all I
> know.
>
> Liam
>
> --
> Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
> Pictures from old books: http://fromoldbooks.org/
> The barefoot typographer

Current Thread