XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Miranda NewmanSubject: Sum with leading zeros
Author: Miranda Newman
Date: 11 Jan 2007 10:02 AM
Hi everyone - I'm new to the board and to XSLT, so please bear with me. This may be an easy solution, but I haven't been able to figure it out. On a form users will enter a number value of seven characters long that could start with several zeros. I want to take this number value and increase it in an increment of '1'. However, when I try to use the 'Sum' and add +1 it is removing the leading zeros. Is there anyway to take the numeric value entered by the user and add 1 and keep the leading zeros? If the answer is 0000001 I want my calculation to be 0000002, however currently it is just returning 2. If you can offer me any help, I would greatly appreciate it.

Postnext
James DurningSubject: Sum with leading zeros
Author: James Durning
Date: 11 Jan 2007 10:56 AM
you could use <xsl:number> eg:

<xsl:variable name="var1" select="3"/>
<xsl:number format="0000001" value="$var1 + 1"/>

Posttop
Miranda NewmanSubject: Sum with leading zeros
Author: Miranda Newman
Date: 11 Jan 2007 05:33 PM
That worked perfectly! I can't thank you enough!

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.