[xsl] Node Text parsing...

Subject: [xsl] Node Text parsing...
From: "Casadome, Francisco Javier" <Francisco.Casadome@xxxxxxxxxxxxxx>
Date: Wed, 7 Nov 2001 18:07:11 +0100
Hi all,

I need some help on the following:

	[... More Sections here ...]
	<Section Title="Fonts">
		<p>Use Arial font, Normal size for regular text. For the <a
href="#Document_Components_Trademarks">trademark acknowledgment</a> section,
use Arial font, size 2. See also <a href="#Appearance_Screen_Text">screen
text</a> and <a href="#HTML_Coding_Requirements_Font_Tags">font
		[... More Sections here ...]
	[... More Sections here ...]

So one section can have as many sections inside as you want.
What I'm trying to do is to format the text as the windows help does.
This is, given a word or phrase, highlight it in the output.

This template already does this given a string as parameter.
Also, "$qry" is the word/phrase you are searching for.

<xsl:template name="S">
<xsl:param name="STR"/>
<xsl:variable name="F" select="user:Found(string($STR), string($qry))"/>
    <xsl:when test="$F='false'"><xsl:value-of select="$STR"/></xsl:when>
      <xsl:value-of select="substring-before($STR, $qry)"/>
	<font color="white" style="background-color: #DC143C;"><xsl:value-of
	<xsl:call-template name="S"><xsl:with-param name="STR"
select="substring-after($STR, $qry)"/></xsl:call-template>

I'm using a custom VBScript function ( user:Found() ) that returns "false"
if nothing I found or the string it finds otherwise. This function does a
case insensitive search.

My problem here is that I don't know how to deal with the internal nodes,
like <a>, <b>, <i>, etc. because there's text then node then text again,
and they should appear in order in the output.

Can anyone help ?
Thanks in advance,

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

Current Thread