|
Subject: RE: [xsl] xsl search engine From: Jarno.Elovirta@xxxxxxxxx Date: Wed, 10 Mar 2004 09:32:41 +0200 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xsl search engine, Ricaud Matthieu | Thread | RE: [xsl] xsl search engine, Ricaud Matthieu |
| [xsl] Sequencing, Numbering, and Co, James Paul | Date | RE: [xsl] Sequencing, Numbering, an, Jarno . Elovirta |
| Month |