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

Re: Remove a quote in a string

Subject: Re: Remove a quote in a string
From: "Bob DuCharme" <bob@xxxxxxxxx>
Date: Tue, 19 Jun 2001 16:16:06 -0400
removing quot in xslt
>     How do I remove a quote in a string.
> Ex. I have a string in a tag like
>     <NAME>O&#8242;Neill</NAME>
>
>      Now in the NAME template, I want to remove the
> quote ie (&#8242) How do I write a translate statement to remove
> that &#8242 and replace it with a quote.

How's this:

<xsl:template match="NAME">
  <xsl:value-of select="translate(.,'&#8242;',&quot;&apos;&quot;)"/>
</xsl:template>

Note that because the double quote character (") is used to quote the select
attribute' s value and the apostrophe (') is the third parameter to pass to
the translate() function, I used &quot; and &apos; entity references to pass
' as a parameter to the function. These two are among the five (along with
lt, gt, and amp) that all XML parsers have to recognize even when they're
not declared.

Bob DuCharme            www.snee.com/bob             <bob@
snee.com>      see http://www.snee.com/bob/xsltquickly for
info on new book "XSLT Quickly" from Manning Publications.



 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.