[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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.
|
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
|