[xsl] Re: Re: Using XSLT to add markup to a document

Subject: [xsl] Re: Re: Using XSLT to add markup to a document
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 7 Jul 2003 22:52:58 +0200
David,

Another problem with this solution is that it finds the strings not strictly
from left to right (when we search for words as opposed to generally strings
this may not be a problem -- my knowledge of English does not allow me to
make a strong conclusion).

Although not specified explicitly, it is inherent in this problem that the
strings must be matched from left to right. If a string precedes and only
partially overlaps another, then the first string should be selected and
highlighted -- not the second one.

For example, if the search strings are "core" and "relation" and the text
is:

"This is a strong corelation."

then I think that "core" should be highlighted and not "relation", because
the text must be scanned from left to right and "core" starts before
"relation".

Using the contains() function for tests with the given strings in any order
will generally violate the left-to-right search requirement.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




"McNally, David" <David.McNally@xxxxxxxxxx> wrote in message
news:34EC278AC7D43745B98BBDC2DF7BC2BA523D49@xxxxxxxxxxxxxxxxxxxxxxxx
> Dimitre,
>
> The only reason I posted this code was because it is something I use, I
like
> it, and I wondered if the apparent lack of recursion had any benefits (the
> answer is no).  I don't think there's any doubt that FXSL, and Jeni's
markup
> utility, are both vastly more general and powerful ways of approaching the
> problem, and I certainly wasn't suggesting that.
>
> However...
>
> > While this is a nice solution, it will not produce good
> > results in the case when one of  the search strings is the
> > start of another of the search strings.
>
> I don't think this is true - it just requires intelligent ordering of the
> xsl:when statements.  You'd want the check for the longer string to appear
> first.  Unless I don't understand how xsl:choose works.
>
> > Also, all possible search strings are hard-coded in the code
> > within an xsl:choose.
>
> Yes.  Not very general, but adequate for everything that I need to do.
>
>
> > This is not going to help in the case when we need to call
> > this template, passing it a parameter containing an unknown
> > number of search strings.
>
> Yes.  I guess you could have a different stylesheet that generated the
code
> of the choose for you.
>
> >
> > Even if you try to use the xsl:choose approach with a
> > moderate number of predefined strings (e.g. 5 - 10), the code
> > will increase quadratically to the number of search strings.
>
> I don't understand this.  For each string you are interested in, there is
> one xsl:when statement.  Why is that quadratic?
>
> Thanks,
> David.
>
>
> ---------------------------------------
>
> The information contained in this e-mail message, and any attachment
thereto, is confidential and may not be disclosed without our express
permission.  If you are not the intended recipient or an employee or agent
responsible for delivering this message to the intended recipient, you are
hereby notified that you have received this message in error and that any
review, dissemination, distribution or copying of this message, or any
attachment thereto, in whole or in part, is strictly prohibited.  If you
have received this message in error, please immediately notify us by
telephone, fax or e-mail and delete the message and all of its attachments.
Thank you.
>
> Every effort is made to keep our network free from viruses.  You should,
however, review this e-mail message, as well as any attachment thereto, for
viruses.  We take no responsibility and have no liability for any computer
virus which may be transferred via this e-mail message.
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>




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


Current Thread