RE: [xsl] xsl search engine

Subject: RE: [xsl] xsl search engine
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 10 Mar 2004 14:07:18 +0200
Hi,

> But I still encounter problems using the recursive 
> template... I search on
> my own a good time cause I didn't want to bother you again 
> (and I thought 'I
> must be able to..'), but finally there 's really something I 
> don't see.
> I notice that I don't really understand the 
> xsl:apply-template element with
> a select attribute...

If you have problems understanding what xsl:apply-templates does, you really need to go back to the spec or a book...
 
> How do I call the tokenizer template ?

  <xsl:call-template name="tokenizer" />

> I was using a <xsl:for-each select="THEME[predicate]"> to display the
> searched THEME.
> With the tokenizer template, there is <xsl:apply-templates
> select="THEME[predicate]/>
> So I guess I should have a <xsl:template match="THEME"> 
> anywhere, but then
> it would match all THEME elements no ?

Template just defines the processing to be carried out when a node that matches the match pattern is processed. Which nodes are processed is defined by the select expression in xsl:apply-templates. So, if you call

  <xsl:apply-templates select="THEME"/>

every THEME child of the current node will be processed, but if you have

  <xsl:apply-templates select="THEME[contains(@label,substring-before($text, ' '))]"/>

those THEME children of the current node whose label attribute contain the substring that comes before the first SPACE character in $text.

> how to say the xslt processor it must match THEME with the perdicate
> calculate in tokenizer template ?
> ...something like <xsl:for-each select="tokenizer?"> but it 
> doesn't make
> sens don't it ?

I don't remember what your source looked like. Basically, where you want to process the matching THEME elements, instead of

   <xsl:for-each select="THEME[predicate]">

just call the tokenizer template.

> But it display all the THEME elements as I said...
> I'm sure there's a little thing I don't see and I will say 
> "Off course !
> that was it !" but right now I'm ...lost :(

If this doesn't work, could you resend your test source, stylesheet so far and the expect output.

Cheers,

Jarno - Grendel: Pax Psychosis (Tactical Sekt remix)

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


Current Thread