[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Thought i knew this but i guess not

Subject: Re: Re: Thought i knew this but i guess not
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Feb 2011 22:51:37 -0500
Re: Re:  Thought i knew this but i guess not
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@xxxxxxxxx> 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@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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.