How do I drop an apostrophe?

Subject: How do I drop an apostrophe?
From: James Garriss <jgarriss@xxxxxxxxx>
Date: Mon, 29 Nov 1999 11:24:08 -0500
Given an XML document like this:

  <foo>
    <bar name="Jim's Code">abc</bar>
  </foo>

How do I get a desired output XML document like this:

<jimscode>abc</jims_code>

Specifically, I'm looking for how to drop apostrophes. I have figured out how to translate (and drop) characters in general using code like this:

<xsl:variable name="upperCaseChars" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowerCaseChars" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="uCaseCharsPlus" select="concat($upperCaseChars, ' /-(),+')"/>
<xsl:variable name="lCaseCharsPlus" select="concat($lowerCaseChars, '')"/>


<xsl:variable name="element_name" select="translate(@name, $uCaseCharsPlus, $lCaseCharsPlus)"/>
<xsl:element name="{$element_name}">
...
</xsl:element>


But I can't get it to work with apostrophes. I have tried escaping it using &#x27;, &#39;, and &apos;, but no luck.

BTW, I'm using LotusXSL on NT.

  James Garriss | The MITRE Corporation | jgarriss @ mitre.org
  "The second mouse gets the cheese."  -- Steven Wright



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread