[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: How do I drop an apostrophe?


Subject: RE: How do I drop an apostrophe?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 30 Nov 1999 09:46:25 -0000

<xsl:variable name="apos">'</xsl:variable>
<xsl:value-of select="translate($chars, $apos, '')"/>

Mike Kay

> -----Original Message-----
> From: James Garriss [mailto:jgarriss@xxxxxxxxx]
> Sent: 29 November 1999 16:24
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: How do I drop an 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
> 


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



Current Thread
Keywords
xml