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

Re: apostrophe in paramter causing output problems

Subject: Re: apostrophe in paramter causing output problems
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 15 Aug 2001 12:52:05 -0600 (MDT)
xml apostrophe problems
Uronis, Jeremy wrote:
> translate($Description,"&apos;","\&apos;")}

Instead of "&apos;", declare a variable like this:
  <xsl:variable name="q">'</xsl:variable>
and then use $q.

However you have a bigger problem in that you misunderstand how
translate() works. It works like the Unix 'tr' utility -- it only
replaces single characters.

You need a recursive template to do arbitrary string replacement.
See http://skew.org/xml/stylesheets/replace/ for one such example.
You'll do this:

<xsl:call-template name="SubstringReplace">
  <xsl:with-param name="stringIn" select="$Description" /> 
  <xsl:with-param name="substringIn">'</xsl:with-param> 
  <xsl:with-param name="substringOut">\'</xsl:with-param>
</xsl:call-template>

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

 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.