Subject: RE: [xsl] Xslt 2 stripping out non-numbers From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx> Date: Tue, 19 Apr 2005 14:35:00 -0400 |
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: [xsl] 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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Xslt 2 stripping out non-, G. Ken Holman | Thread | Re: [xsl] Xslt 2 stripping out non-, Dimitre Novatchev |
RE: [xsl] Xslt 2 stripping out non-, G. Ken Holman | Date | Re: [xsl] Xslt 2 stripping out non-, Aron Bock |
Month |