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

RE: xsl search engine

Subject: RE: xsl search engine
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 10 Mar 2004 09:32:41 +0200
thou shalt not headhunter
Hi,

> >>No, you have to use an extension or use translate($text, 
> 'ABCDEFG...',
> 'abcdefg...').
> 
> Yes but than bla would become BLA and while searchin for Bla, 
> it won't find
> it...
> I would "simply" like BLA, bla, Bla, bLa, blA, bLA, etc. would all be
> "equivalent".

Translate both strings to lowercase.
 
> >>A recursive template. Tokenize the query string, and test each token
> individually.
> 
> I don't really see how to write this recursive template, can 
> you explain
> more.
> I think the difficult thing will be to separate the string into many
> substrings according to the "spaces" (n spaces ==> n+1 words)

<template name="tokenizer">
  <param name="text" select="normalize-space($string)"/>
  <if test="$text">
    <apply-templates select="THEME[contains(@label,substring-before($text, ' '))]"/>
    <call-templates name="tokenizer">
     <with-param name="text" select="substring-after($text, ' ')"/>
    </>
  </>
</>

goes throught each token in $string and processes each THEME whose label attribute contains the token.

> 	> 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.
> 
> Oups, yes there were an error in what I wrote. I actually generate
> "THEME[contains(@label,"what_the_user_wrote")]" as string 
> which is send as
> $string parameter to the xsl. I do it because the user may 
> also want to
> search among only THEMES whose topic attribute is 
> "Mathematics" for instance
> or maybe all of them. The string I generate is than rather :
> 	 	THEME[contains(@label,"what_the_user_wrote") 
> and @topic="Mathematic"]
> or simply	THEME[contains(@label,"what_the_user_wrote")]
> 
> I must generate this before sending it to xsl because if I wrote :
> 
> <xsl:for-each select="THEME[contains(@label,$string)] and 
> @topic=$string2">
> 
> then for $string2="" (nothing ==> that means EVERY topics), 
> the xsl would
> not match any THEME...

Why not use xsl:choose to process differently when $string2 is empty?

Cheers,

Jarno - Thou Shalt Not: Headhunter (Front 242 cover)... hilarious :D

 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.