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

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
james james s james apostrophe
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

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.