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

Re: using contains() to search xml doc and matching r

Subject: Re: using contains() to search xml doc and matching regardless of case
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 3 Aug 2007 09:17:19 +0530
Re:  using contains() to search xml doc and matching  r
Please try this:

<xsl:variable name="smallCase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

<xsl:if test="contains(translate(PUBLICDESCRIPTION_STRING, $smallCase,
$upperCase), translate($filter, $smallCase, $upperCase))">

On 8/3/07, Jessica Hennessey <jessica@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I am trying to filter my xml document to only output records based on a
> search string.  I have the basic search functionality working using the
> xsl:if and the contains() function.  Unfortunately for me, this is searching
> for an exact match including case.  I need it to be case insensitive.
>
> My initial thought was to make everything in my search field lowercase and
> force my incoming parameter to be lowercase.  However, I couldn't seem to do
> that from within the contains function.  The publicdescription field is not
> displayed on this page, so I can do anything I want to it.
>
> Here is my xsl
>
> <?xml version='1.0'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:param name="order"/>
> <xsl:param name="orderdirection"/>
> <xsl:param name="filter"/>
>
> <xsl:template match="/">
>
>
>      <xsl:for-each select="root/job">
>          <xsl:sort select="*[name()=$order]" order="{$orderdirection}"/>
>          <xsl:if test="contains(PUBLICDESCRIPTION_STRING, $filter)">
>      <tr>
>        <td><a>
>   <xsl:attribute name="href">jobdetail.asp?jobid=<xsl:value-of
> select="JOBPOSTINGID_INT"/></xsl:attribute>
>   <xsl:value-of select="TITLE_STRING" /></a></td>
>                <td><xsl:value-of select="CITY_STRING"/>, <xsl:value-of
> select="STATE_STRING"/></td>
>        <td><xsl:value-of select="EMPLOYMENTTYPE_STRING"/></td>
>      </tr>
>          </xsl:if>
>      </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> Thanks to everyone who got me this far!!!I think this is the last obstacle.
>
>
>
>
> Jessica Hennessey
> Sunlight Studios - Internet Consulting & Development
> www.sunlightstudios-icd.com


-- 
Regards,
Mukul Gandhi

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.