[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] search against index


Subject: Re: [xsl] search against index
From: bry@xxxxxxxxxx
Date: Thu, 7 Aug 2003 20:28:29 CET

>       <xsl:when test="contains
($string,'+')">
>         <xsl:call-template name="search">
>           <xsl:with-param name="nodes" 
select="$nodes[contains(@value,normalize-
space
> (substring-before($string,'+')))]"/>
>           <xsl:with-param name="string" 
select="normalize-space(substring-after
> ($string,'+'))"/>
>         </xsl:call-template>
>       </xsl:when>

Thanks, but unfortunately what I was trying 
to get at was the search has to accept

value + value + value.... and so on until 
one runs out of + value.
Hence the need to keep building and paring a 
nodeset, the main problem with building 
multiple nodesets is I figured had to be a 
better way, am thinking I might have found 
one on the way home:


step 1: split searchstring and build a 
nodeset

step 2: for each node in searchstring 
nodeset copy index node from document that 
contains searchstring value in value 
attribute. Add id attribute that consists of 
the count of current index node.

Thus building a bigger rtf with the 
possibility of the following:
<list>
<index value="another string here" id="2">
..
</index>
<index value="another string here" id="2">
</index>
<index value="a string" id="3">...
</index>
</list>


step 3:
the number of nodes in the searchstring 
nodeset tells us how many index's have to be 
returned with the same id, that is to say if 
the original searchstring was string+another 
then I end up with two searchstring nodes
and thus from my big nodeset I should be 
able to do something like
<xsl:apply-templates select="gen:node-set
($bignodeset)/list/index[count(following-
sibling::index[@id = $myid]) -1 = 
$searchstringcount]"/>

Since I haven't tried this yet I'm not sure 
which would give better results, i.e. this 
or the earlier building node-sets all over 
hell, can depend on the processor I suppose, 
I'm currently in msxml which made me worry 
as building a node-set is basically the same 
as creating a new dom. But I'm thinking this 
method is probably the quicker (only thing 
that worries me of course is that my nodeset 
of index items could conceivably grow very 
big). If anyone has any suggestions on 
improving that would be cool, in fact also 
wondering if fxsl, and Dimitre's new exslt 
implementation doesn't allow for improving 
at least the last step of the way. 

Also Andrew's suggestion of generating the 
xslt unfortunately can't be followed in this 
instance. 







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



Current Thread
Keywords