RE: [xsl] xsl search engine

Subject: RE: [xsl] xsl search engine
From: "Ricaud Matthieu" <matthieu.ricaud@xxxxxxx>
Date: Wed, 10 Mar 2004 12:08:05 +0100
Great advices Jarno ! Thanks again.

About generating the string with asp, you're right, it's quite more simple
to use xsl:chose,
why did i not thought about it !? (dummy me !)

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...

How do I call the tokenizer template ?
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 ?
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 ?

So my xsl look lyke this now :

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:output method="html" indent="yes"/>
	<xsl:param name="String"/> <!-- string sent by the xslt processor -->

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

	<xsl:template match="LIST">
		<form action="display.asp" method="POST">
			<input type="text" name="UserString"/>
			<input type="submit" value="Go!"/>
		</form>
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="THEME">
		<xsl:value-of select="@label"/><br/>
	</xsl:template>

</xsl:stylesheet>

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 :(
In advance thanks for your Patience...

Matt



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


Current Thread