[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: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 24 May 2007 13:40:08 +0530
Re:  Extract only numeric value
Please try the following XSLT 2.0 solution:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

<xsl:output method="xml" indent="yes" />

 <xsl:template match="x">
    <year><xsl:value-of select="replace(year, '[a-zA-Z]', '')" /></year>
 </xsl:template>

</xsl:stylesheet>

When this is applied to input XML:

<x>
<year>X2A007a</year>
</x>

The output produced is:

<year>2007</year>

Any alphabetic characters anywhere, are replaced by an empty string ('').

On 5/24/07, J. S. Rawat <jrawat@xxxxxxxxxxxxxx> 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

-- Regards, Mukul Gandhi

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.