Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 12th, 2008, 01:40 AM
Authorized User
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Removing leading zeros from a string value


Is there any way to remove all the leading zeros from a string value.
Thanks for your help in advance.
Old June 12th, 2008, 02:25 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

If the string is entirely numeric, convert it to a number and back again: string(number($in)).

Alternatively, in XSLT 2.0, replace($in, '^0*', '')

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Old June 12th, 2008, 03:30 AM
Authorized User
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts

Thx a lot Michael Kay..:)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transform String, Removing Characters. v01 XSLT 3 November 21st, 2008 01:58 PM
SQL - removing trailing zeros skywalker1981 SQL Server 2000 4 April 1st, 2008 08:32 AM
Remove Leading and Trailing Zeros lene_wee SQL Server 2000 3 April 1st, 2008 08:23 AM
Removing Double Quotes from a string Durkee VB.NET 2002/2003 Basics 12 October 4th, 2007 12:10 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.