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

Escaping Characters in replace()

Subject: Escaping Characters in replace()
From: Nathan Tallman <ntallman@xxxxxxxxx>
Date: Tue, 15 Oct 2013 12:13:16 -0400
 Escaping Characters in replace()
This is a basic question, sorry for wasting your time. But, I'm having
trouble escaping quotes.

Here's what my input looks like:

 <unittitle>"The Atomic Bomb Foreshadowed: 1700 Years Ago".</unittitle>

Here's my XSLT (2.0):

<xsl:template match="unittitle/text()">
      <xsl:value-of select="normalize-space(replace(., '""..', '..""'))"/>
</xsl:template>

I'd like to search for all occurrences of ". and replace them with ."
I don't think I can use &quote; because the original input has the
literal quote and note an entity reference. I've been searching online
and have tried to escape with backslash, double backslash, double
quote, double period, but can't get it working.

I also tried variables, as below, but my processor (Saxon-EE 9.4.0.4)
threw an error, expecting a digit after the dollar sign.
<xsl:template match="unittitle/text()">
      <xsl:variable name="quote">"</xsl:variable>
      <xsl:variable name="period">.</xsl:variable>
      <xsl:value-of select="normalize-space(replace(.,
'$quote$period', '$period$quote'))"/> </xsl:template>


This is basic, so should be simple. But I'm lost. Can someone please
point me in the right direction?

Thanks,
Nathan

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.