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

RE: How to filter characters from a string?

Subject: RE: How to filter characters from a string?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 29 Mar 2002 21:11:07 -0000
filter characters
Write a translate that removes all the characters that are allowed in
base64. The result of this translate is a string containing all the
characters that aren't allowed, i.e. the ones you want to remove. Use this
as the second parameter for another translate():

translate($x, translate($x, 'ABCDE...abcde...12345...', ''), '')

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Greg Faron
> Sent: 28 March 2002 19:10
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How to filter characters from a string?
>
>
> Hi all,
>
>    I'm practicing XSLT and decided to write my own Base 64
> encoder and
> decoder templates.  The rules for Base 64 Encoding say that only the
> following characters (in an encoded file) should be examined
> upon decoding:
> <xsl:variable name="base64Map"
> select="'ABCDEFGHIJKLMNOPQRSTUVWXYZabcedfghijklmnopqrstuvwxyz0
> 1234567890+/='"/>
>
>    This means that I would like to filter out every character
> that is not
> one of the 65 above characters.  I realize that I could do
> this partially
> with translate(), but then I would need to specify every
> possible illegal
> character, of which there are thousands (if you have Unicode
> characters in
> there).  A smaller version of such a command would be
> translate($encodedString,
>            $base64Map,
>            concat($base64Map,
>                   '=&#xA;&#xD;
> `~!@#$%^&amp;*()-_)&quot;&apos;[]{}|\&lt;&gt;,.?;:'))
>
>    Are there any templates or commands to delete any
> character from the
> first argument that DOESN'T appear in the second argument?  I'm using
> Microsoft XSLT engine MSXSL4.
>
>
> Greg Faron
> Integre Technical Publishing Co.
>
>
>
>  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

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.