This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Node Text parsing...
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Node Text parsing...
- From: "Casadome, Francisco Javier" <Francisco dot Casadome at bowneglobal dot es>
- Date: Wed, 7 Nov 2001 18:07:11 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi all,
I need some help on the following:
My XML:
<Sections>
[... 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
tags</a>.</p>
[... More Sections here ...]
</Section>
[... More Sections here ...]
</Sections>
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:choose>
<xsl:when test="$F='false'"><xsl:value-of select="$STR"/></xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($STR, $qry)"/>
<font color="white" style="background-color: #DC143C;"><xsl:value-of
select="$F"/></font>
<xsl:call-template name="S"><xsl:with-param name="STR"
select="substring-after($STR, $qry)"/></xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl: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,
etc.
and they should appear in order in the output.
Can anyone help ?
Thanks in advance,
Frank.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list