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

Subject: Re: [xsl] marking up text when term from other file is found
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 22 Apr 2010 13:29:48 +0100
On 22/04/2010 12:54, Wolfgang Laun wrote:
Two comments and two questions.

Q1:  XSLT patterns don't have the zero-length assertion \b available
to match a word boundary. This may result in unexpected matches. With
analyze-string it is not possible to apply the usual trick of adding
an extra character before and after the string. So how can an exact
match be done here?

You can pre-rocess the string to put in reliable separators (usually) there were some examples in a thread on this list a few weeks back.
But exactly what you need to do depends on what the answer is supposed to be if the input string looks like
......Sick children, illness...


as then case insensitive matches would lead to a requirement to use overlapping markup around .Sick children and children, illness

Or perhaps in real cases you know such overlaps don't matter (in which case you may also know you don't need to worry about word boundaries)



Q2: If the index or document is big, it might be faster to have xsl:key on the indexTerms. Is it possible to construct such a key with the matching string being the original<term/> content *in lowercase*?

not sure what you mean but <xsl:key match="something" use="lower-case(term)"/> might be the answer.

Can it be done by constructing a temporary tree and applying xsl:key
to that?

No an xsl:key always applies to all documents, so if you do need to construct a temporary document its use would be with key() rather than xsl:key

-W



________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread