XSL Fixed text output

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have a scenario where from the XML, I need to get some fixed text output. Say I have the following XML, the text output should be like
Name1 00000 3456700000
The scenario here is - Say the first element should start at position 1 and end at position 10, if the text is only say 5 characters, the rest of the place should be blank, I never know what will be the size of the text(in this case say Name1) then the next
5 character positions should be zeros 00000 then say another field will come which is numeric, and can occupy 10 characters, but if the value is positive and it is only 3 digits, I will append it with zeros for the remaining 7 positions; but if it is negative,
I need to add the zeros prior to the text i.e., the first 7 digits will be zeros.
These are the basic rules, if you could advice me on how to take it in the XSL, it will be great, thanks.
<Employees><br/>
<EmployeeCompany><br/>
<ID>1</ID><br/>
<Name>Name1</Name><br/>
<Name2>Name2</Name2><br/>
</Employee><br/>
<Employee><br/>
<ID>2</ID><br/>
<Name>Name1a</Name><br/>
<Name2>Name2b</Name2><br/>
</Employee><br/>
<Employee><br/>
<ID>3</ID><br/>
<Name>Name1c</Name><br/>
<Name2>Name3c</Name2><br/>
</EmployeeCompany><br/>
<Employees>

<hr class="sig Rpaul

View the full article
 
Back
Top