[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
Hi,

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:choose>
    <xsl:when test="$p_textsearch!='' and contains(.,$p_textsearch)">
      <xsl:call-template name="marquage">
        <xsl:with-param name="p_text" select="."/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="."/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template name="marquage">
  <xsl:param name="p_text" select="''"/>
  <xsl:choose>
    <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"/>
      </font>
      <xsl:call-template name="marquage">
        <xsl:with-param name="p_text" select="substring-after($p_text,$p_textsearch)"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$p_text"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
-------------------
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.