[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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 é). If I have words with entities in them, like cathé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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|