RE: [xsl] xsl search engine

Subject: RE: [xsl] xsl search engine
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 9 Mar 2004 14:55:48 +0200
Hi,

> <xsl:param name="string"/>
> 
> <xsl:template match="LIST">
> 	<xsl:for-each select="THEME[contains(@label,$string)]">
> 		<xsl:value-of select="@label"/><br/>
> 	<xsl:for-each/>
> </xsl:template>
> 
> So the problem is that this engine is not really performant : 
> if as user i
> search "Bla" it won't find it because of the case "B" instead 
> of "b". Is it
> possible to say IgnoreCase in xsl ?

No, you have to use an extension or use translate($text, 'ABCDEFG...', 'abcdefg...').

> The other (bigger) problem is that if the user write many 
> words (with spaces
> in between) "bla blo", the it will looks for this exact 
> string whereas i'd
> like it to search for bla OR blo. Is there a way to make it in xsl ? a
> special function ?

A recursive template. Tokenize the query string, and test each token individually.
 
> PS : in my project, i generate the whole Path
> "THEME[contains(@label,$string)]" with asp and this is the 
> string parameter
> i send to the xsl and then i do : <xsl:for-each
> select="dyn:evaluate(.,$string)"> (evaluate is a function from the dyn
> namespace which calculate the xPath expression. Maybe i could make an
> traitment direct in the aps page to do what i want ?

Umm... why don't you just use the expression THEME[contains(@label,$string)] and pass query string in with $string? I must be missing something here; wish I could say "Well, I am psychic, you know" like she can.

Cheers,

Jarno - Bruderschaft: Forever (Darkness Pulls Me Under Remix by State of the Union)

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


Current Thread