ok, fair enough.
i was just hoping that somebody could give me some ideas
about how to sturcture my categories.xml file for the kind of
search i am trying to do.
another poster provided some useful code for the XSL file (below).
but now, if somebody could show me how to pass the value from
the user's search string on the client to the XSL file and, how to
structure the XML file for the kind of "proximity searching" that
i was discussing wiht Peter. Should each node contain a string
of key words?
If this is an application design issue and not an XML problem, fair
enough. otherwise, advice appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl
utput method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
<!--change <xsl:variable name="data" select="'met sport baseball'"/>
in
<xsl
aram name="data"/>-->
<xsl:variable name="data" select="'met sport baseball'"/>
<xsl:variable name="upperCase"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowerCase"
select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="test"
select="translate($data,$upperCase,$lowerCase)"/>
<xsl:template match="/">
<xsl:apply-templates select="*/*">
<xsl:with-param name="search" select="$test"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*">
<xsl
aram name="search"/>
<xsl:variable name="result">
<xsl:call-template name="searching">
<xsl:with-param name="Sdeb" select="$search"/>
<xsl:with-param name="Send" />
<xsl:with-param name="val" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string($result)=''">
trouvé <xsl:value-of select="."/>
</xsl:if>
</xsl:template>
<xsl:template match="*[@title]">
<xsl
aram name="search"/>
<xsl:variable name="result">
<xsl:call-template name="searching">
<xsl:with-param name="Sdeb" select="$search"/>
<xsl:with-param name="Send" />
<xsl:with-param name="val" select="@title"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="string($result)=''">
trouvé <xsl:value-of select="@title"/>
</xsl:when>
<xsl
therwise>
<xsl:apply-templates select="*">
<xsl:with-param name="search" select="string($result)"/>
</xsl:apply-templates>
</xsl
therwise>
</xsl:choose>
</xsl:template>
<xsl:template name="searching">
<xsl
aram name="Sdeb"/>
<xsl
aram name="Send"/>
<xsl
aram name="val"/>
<xsl:variable name="trans">
<xsl:choose>
<xsl:when test="contains($Sdeb,' ')">
<xsl:value-of select="substring-before($Sdeb,' ')"/>
</xsl:when>
<xsl
therwise>
<xsl:value-of select="$Sdeb"/>
</xsl
therwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="word" select="string($trans)"/>
<xsl:choose>
<xsl:when
test="contains(translate($val,$upperCase,$lowerCase),$word)">
<xsl:choose>
<xsl:when test="$Sdeb=$word">
<xsl:value-of select="$Send"/>
</xsl:when>
<xsl
therwise>
<xsl:call-template name="searching">
<xsl:with-param name="Sdeb"
select="substring-after($Sdeb,' ')"/>
<xsl:with-param name="Send" select="$Send"/>
<xsl:with-param name="val" select="$val"/>
</xsl:call-template>
</xsl
therwise>
</xsl:choose>
</xsl:when>
<xsl
therwise>
<xsl:choose>
<xsl:when test="$Sdeb=$word">
<xsl:value-of select="concat($Send,' ',$word)"/>
</xsl:when>
<xsl
therwise>
<xsl:call-template name="searching">
<xsl:with-param name="Sdeb"
select="substring-after($Sdeb,' ')"/>
<xsl:with-param name="Send" select="concat($Send,'
',$word)"/>
<xsl:with-param name="val" select="$val"/>
</xsl:call-template>
</xsl
therwise>
</xsl:choose>
</xsl
therwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>