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

RE: Case sensitive filter

Subject: RE: Case sensitive filter
From: Stuart Brown <sbrown@xxxxxxxxxxxxx>
Date: Wed, 18 Sep 2002 13:28:24 +0100
xsl case
Hi Terry,

To achieve case-insensitive searching, just use translate() to change the
strings to all-lower case.
To achieve the security filter, why not just include that condition as
another predicate on the
menu step (or am I missing something?).

I think the following should work (although it's untested):

<xsl:variable name="searchNode"
select="msxsl:node-set(//resource//menu[contains(@id,$prmSecCat)]
[contains(translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'),translate($prmSearch,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))] |
//resource[contains(translate(notes,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz'),translate($prmSearch,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))]"/>

Cheers,

Stuart


> -----Original Message-----
> From: Terry Clark [mailto:tclark@xxxxxxxxxxxxxxxxxxxx]
> Sent: 18 September 2002 12:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Case sensitive filter
> 
> 
> Hi
> 
> Two part question (I hope).
> 
> I have created a search engine for a site that passes the 
> search string
> through to an ASP page that passes it back into the xsl template as a
> parameter. I then use this parameter to create a node set as 
> sub set of
> the main data set.
> 
> i.e. <xsl:variable name="searchNode"
> select="msxsl:node-set(//resource//menu[contains(.,$prmSearch)] |
> //resource[contains(notes,$prmSearch)])"/>
> 
> Which works to a certain extent, the problem is the old case sensitive
> one. If the search string is in a menu node it would normally have the
> first letter capitalised (or all of them) where as if it is 
> in the notes
> it may well be all lowercase and as a consequence not all results are
> being returned. I have had a look at the translate function but am
> unsure how/if to use it in this scenario.
> 
> Part two:
> Part of the site "security" is to only allow access to certain menu
> options which works fine when I am creating the menu 
> structure as I only
> include those that have a certain string in the ID attribute, however
> the search brings back results they should not be able to access, how
> could I go about restricting the result set of $searchNode (see above)
> so that only the eligible nodes are selected. In the menu 
> creation I use
> :
> 			<xsl:if test="contains(@id,$prmSecCat)" />
> ....</xsl:if>
> To only display the correct menu options. How could I 
> integrate the same
> logic in the creation of the $searchNode variable
> 
> Thanks
> 
> Terry
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.