[xsl] Escaping Characters in replace()

Subject: [xsl] Escaping Characters in replace()
From: Nathan Tallman <ntallman@xxxxxxxxx>
Date: Tue, 15 Oct 2013 12:13:16 -0400
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