Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

remove leading zeros

Posted on 2013-06-18
3
Medium Priority
?
320 Views
Last Modified: 2013-06-18
I have the following input XML

<root>
      <Envelope>
            <Body>
                  <TravelRS SequenceNmbr="1">
                        <CustomerInfos>
                              <PersonName>
                                    <Extensions>
                                          <NameNumber Number="01.01"/>
                                    </Extensions>
                              </PersonName>
                        </CustomerInfos>
                  </TravelRS>
            </Body>
      </Envelope>
</root>


I have the following code
<xsl:variable name="OTSeatId" select="Envelope/Body/TravelRS/CustomerInfos/PersonName/Extensions/NameNumber/@Number" />


 I'd like to remove leading zeros, before and after decimal.
So 01.01 becomes 1.1


Please assist.
0
Comment
Question by:badtz7229
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 39257526
<xsl:value-of select="concat(number(substring-before($OTSeatId, '.')), '.', number(substring-after($OTSeatId, '.')))"/>

by splitting in two parts and calling the number function on each parts, the zeroes will go away
0
 

Author Closing Comment

by:badtz7229
ID: 39257588
: Gertone
thx so much. that worked.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39257596
welcome
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question