[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Word Highlighting

Subject: Word Highlighting
From: Paul Terray <terray@xxxxxxxxxxxx>
Date: Tue, 05 Nov 2002 09:59:45 +0100
word highlighting

Sorry if it is a double.

I have a specific problem: I want to highlight a word specified by a parameter outside my stylesheet.

I know how I can do that, with a recursive approach :
<xsl:template match="text()">
    <xsl:when test="$p_textsearch!='' and contains(.,$p_textsearch)">
      <xsl:call-template name="marquage">
        <xsl:with-param name="p_text" select="."/>
      <xsl:value-of select="."/>

<xsl:template name="marquage">
  <xsl:param name="p_text" select="''"/>
    <xsl:when test="contains($p_text,$p_textsearch)">
      <xsl:value-of select="substring-before($p_text,$p_textsearch)"/>
      <font color="red">
      <xsl:value-of select="$p_textsearch"/>
      <xsl:call-template name="marquage">
        <xsl:with-param name="p_text" select="substring-after($p_text,$p_textsearch)"/>
      <xsl:value-of select="$p_text"/>
Now, my problem is that the text is french, with characters entities (like &eacute;). 

If I have words with entities in them, like cath&eacute;drale, they are considered as three text() nodes, not one, and my template matching fails. 

Does someone have a solution ?

Thanks in advance.

Paul TERRAY - Documents Management Systems Engineer
email : terray@xxxxxxxxxxxx 

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.