xsl-list
[Top] [All Lists]

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

2011-02-22 21:51:48
Might want spaces at the beginning, as well, in case a value might be
a suffix of another value:

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

-Brandon :)


On Tue, Feb 22, 2011 at 10:45 PM, Chris Maloney <voldrani(_at_)gmail(_dot_)com> 
wrote:
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(_at_)w3(_dot_)org> 
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(_at_)w3(_dot_)org> 
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--