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

Search and Replace to add HTML tags

Subject: Search and Replace to add HTML tags
From: Sharon_Harris@xxxxxxxxxxxxxxxxxxxx
Date: Tue, 30 Jun 2009 13:30:23 -0400
 Search and Replace to add HTML tags
I am trying to wrap specific text in a string within HTML tags. For
example, if a strings contains the word "Note:", then I want to enclose
this word within a set of bold tags (<b>Note:</b>). I do not have control
over the XML data source and cannot modify the structure/schema.

I have tried using the replace function to search for the specific text and
then replace it with a defined variable. The variable contains the text
wrapped within the HTML tags. Unfortunately, only the content within the
variable is getting pulled and the HTML tags are being ignored. Can anyone
tell me how to get the tags added as well during the search and replace?

XML excerpt:
   <Row>
   <ReleaseNote>Before: The application did this. Now: The application does
   this. Note: The application may also do this.</ReleaseNote>
   </Row>
   <Row>
   <ReleaseNote>Before: The application did not do this. Now: The
   application does this.</ReleaseNote>
   </Row>

XSLT excerpt:
   <xsl:variable name="NoteBold"><b>Note:</b></xsl:variable>
   <xsl:variable name="BeforeBold"><b>Before:</b></xsl:variable>
   <xsl:variable name="NowBold"><b>Now:</b></xsl:variable>

   <xsl:template match="text()">
      <xsl:value-of select="replace(replace(replace(.,'Note:',$NoteBold),
   'Before:',$BeforeBold), 'Now:', $NowBold)"/>
   </xsl:template>



Thanks for your help!
_______________________________
Sharon Goldner Harris
Knowledge Management Evangelist
Ultimate Software Group
704-660-6482

Confidentiality Note: This e-mail message and any attachments to it are
intended only for the named recipients and may contain legally privileged
and/or confidential information. If you are not one of the intended
recipients, do not duplicate or forward this e-mail message.

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.