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

Node Text parsing...

Subject: Node Text parsing...
From: "Casadome, Francisco Javier" <Francisco.Casadome@xxxxxxxxxxxxxx>
Date: Wed, 7 Nov 2001 18:07:11 +0100
node.text
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


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.