Hi
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
bry(_at_)itnisk(_dot_)com
Sent: Thursday, August 07, 2003 9:28 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] search against index
<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.
The search accepts "value + value + value + ... + value" and it returns the
node that pass the criteria
Have you even try it? I've try it with msxml, xalan and saxon and it worked
wit hall of them.
It simply get the first value and passes the rest of the string and the
nodes that matches that value to it self util the string has no more '+',
that is when it apllys the last filter and copy what remains
Hence the need to keep building and paring a
nodeset, the main problem with building
You don't need to build them, just to select those that contains your
'value'
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[(_at_)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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list