RE: [xsl] Removing leading zeros from String like 000747-918-1212

Subject: RE: [xsl] Removing leading zeros from String like 000747-918-1212
From: "Kotes Mogili" <Kotes.Mogili@xxxxxxxxxxxxxxxxx>
Date: Tue, 16 Mar 2004 14:53:05 -0500
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: [xsl] 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: [xsl] 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


Current Thread