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

Re: Extract only numeric value

Subject: Re: Extract only numeric value
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Thu, 24 May 2007 14:03:12 +0530
Re:  Extract only numeric value
Thanks Abel, as I always get a quick response from the list and you are one of them. Actually I am quite comfortable with XSLT but I am part of that team where nobody knows abc about the xslt. I am totally dependent over this list only for even a very small questions. I have a reference guide XSLT 2nd edition by Michael Kay. Would you please suggest me a good books/sites of Advance XSLT.

thanks
...JSR

At 10:09 AM 5/24/2007 +0200, you wrote:
Hi JS,

This is a faq, though the faq entry is hidden behind the name "check for integer", it actually shows how to use a regex to match an integer. It should be easy to extract the integer part based on these regexes: http://www.dpawson.co.uk/xsl/rev2/datatypes.html#d15622e974

If you don't care about the fuzz, you can also use simply (\d+) which will greedily grab the number.

Or you can do tokenize($var, '\D+') which will give you all numbers. You may want to change that to tokenize($var, '\D+')[.] to remove empty items of the sequence.

Cheers,
-- Abel Braaksma

J. S. Rawat wrote:
Dear All,
I would like a help about to extract numeric value.

Input
<year>2007a</year>
Output
<year>2007</year>

Thanks in advance for your kind help.
...JSR

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.