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

RE: Xslt 2 stripping out non-numbers

Subject: RE: Xslt 2 stripping out non-numbers
From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx>
Date: Tue, 19 Apr 2005 14:35:00 -0400
jim neff
Ken and Mukul,

Thank you for your responses.  Yes I am not a version 2 fanatic (yet) so
this will work just fine for me.

Thanks again,
Jim



> -----Original Message-----
> From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
> Sent: Tuesday, April 19, 2005 2:12 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Xslt 2 stripping out non-numbers
> 
> At 2005-04-19 13:53 -0400, Jim Neff wrote:
> >The characters to be removed could be anything, upper, 
> lower, hyphens, 
> >spaces ... Anything NaN.
> >...
> > > -----Original Message-----
> > > From:     Jim Neff <jneff@xxxxxxxxxxxxxxx>
> > > Sent:     Tue, 19 Apr 2005 13:22:30 -0400
> > > To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > > Subject:   Xslt 2 stripping out non-numbers
> > >
> > > Greetings,
> > >
> > > I need to strip out non-numerical values from a string.
> > >
> > > Here is a sample input value:  TUV0062
> > >
> > > And what I want is :  0062  (or just 62)
> >...
> > > What is the correct way to do this using XSLT 2?
> 
> Would an XSLT 1 compatible method be acceptable?
> 
> I hope the below helps.
> 
> . . . . . . . Ken
> 
> t:\ftemp>type neff.xsl
> <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                  version="1.0">
> 
> <xsl:output method="text"/>
> 
> <xsl:template match="/">
>     <xsl:variable name="target" select="'TUV0062'"/>
> 
>     <xsl:value-of select="number(
>                            translate($target,
>                             translate($target,'0123456789',''),''))"/>
> </xsl:template>
> 
> </xsl:stylesheet>
> t:\ftemp>saxon neff.xsl neff.xsl
> 62
> t:\ftemp>
> 
> --
> World-wide on-site corporate, govt. & user group XML/XSL training.
> G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
> Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
> Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
> Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc
> Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.