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

RE: Removing leading zeros from String like 000747-918

Subject: RE: Removing leading zeros from String like 000747-918-1212
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 16 Mar 2004 23:15:19 -0000
remove leading zeros
Of course, it's easier in XSLT 2.0:

<xsl:value-of select="replace(., '^0*', '')"/>

Michael Kay 

# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
# [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
# Kotes Mogili
# Sent: 16 March 2004 19:53
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: RE:  Removing leading zeros from String like 
# 000747-918-1212
# 
# Thanks for the suggestion. I was able to solve the problem by 
# creating a new template and calling from a variable like
# 
# <xsl:variable name="a">
#         <xsl:call-template name="removeLeadingZeros">
#             <xsl:with-param name="phone">
#                 <xsl:value-of select="EVENT/ContactPhone"/>
#             </xsl:with-param>
#         </xsl:call-template>
#     </xsl:variable>
# 
# <xsl:template name="removeLeadingZeros">
#         <xsl:param name="phone"/>
#         <xsl:message>
#             <xsl:value-of select="$phone"/>
#         </xsl:message>
#         <xsl:choose>
#             <xsl:when test="starts-with($phone,'0')">
#                 <xsl:call-template name="removeLeadingZeros">
#                     <xsl:with-param name="phone">
#                         <xsl:value-of 
# select="substring-after($phone,'0' )"/>
#                     </xsl:with-param>
#                 </xsl:call-template>
#             </xsl:when>
#             <xsl:otherwise>
#                 <xsl:value-of select="$phone"/>
#             </xsl:otherwise>
#         </xsl:choose>
#     </xsl:template>
# 
# Thanks for spending time...
# 
# Thanks
# Kotes
# 
#  -----Original Message-----
# From: 	owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
# [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]  On Behalf Of 
# Norma Yeazell
# Sent:	Tuesday, March 16, 2004 2:32 PM
# To:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject:	RE:  Removing leading zeros from String 
# like 000747-918-1212
# 
# Here is the clue I got earlier this week
# 
# Have a look at format-number(), you will need something like:
# 
# <xsl:value-of select="format-number(.,0)"/> 
# 
# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
# Kotes Mogili
# Sent: Tuesday, March 16, 2004 2:18 PM
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject:  Removing leading zeros from String like 000747-918-1212
# 
# Hi,
# 
# I am trying to remove leading zeros from a String like 
# "000747-918-1212"
# .  Please let me know if there is any function available in 
# XSL to do this.
# 
# Thanks for your time
# 
# Thanks
# kotes
# 
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
# 
# 
# 
# Confidentiality Notice
# The information contained in this e-mail is confidential and 
# intended for use only by the person(s) or organization listed 
# in the address. If you have received this communication in 
# error, please contact the sender at O'Neil & Associates, 
# Inc., immediately. Any copying, dissemination, or 
# distribution of this communication, other than by the 
# intended recipient, is strictly prohibited.
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
# 
# 
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
# 
# 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.