xsl-list
[Top] [All Lists]

Re: [xsl] marking up text when term from other file is found

2010-04-22 07:53:34
On Thu, Apr 22, 2010 at 5:24 PM, Wolfgang Laun 
<wolfgang(_dot_)laun(_at_)gmail(_dot_)com> wrote:
C1:  The pattern containing all terms can be constructed once and not
repeatedly within the template doing the analyze-string.

I agree. Thanks for the observation.

So, I propose following changes to the stylesheet:
1) Have a global variable as following,
  <xsl:variable name="term-regex" select="string-join(for $term in
$index-terms/terms/term
                                                                           
return concat('(', $term, ')'), '|')" />

2) and change, the 'analyze-string' instruction to following,
<xsl:analyze-string select="."
                             regex="{$term-regex}">
 ...

C2:  The flags attribute of analyze-string should be used to do a case
insensitive match: flags='i'

I agree :)


-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>