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

How to pad space to a text node to make it have specfic leng

Subject: How to pad space to a text node to make it have specfic length?
From: "Albert Tsun" <albert.tsun@xxxxxxxxxxxx>
Date: Wed, 18 Oct 2000 16:46:26 +0800
padleft xslt

Hi all,

I am trying hard to pad space to a text node so that the data value
will have a specific length.

XML Source :
<records>
     <record>
          <field1>abc</field1>
          <field2>abcdef</field2>
     </record>
     <record>
          <field1>123</field1>
          <field2>12345</field2>
     </record>
</records>

My current task is to transform it to a fixed length record files which
look like
abc  |    abcdef|
123  |     12345|


I want to pass the <field1> to template "padleft" with field1 text node and
desired length
and <field2> to "padright" in order to make a fixed length output. However,
with all the
String functions in XSLT, I can't figure out how I can implement this.
would some help me
and give me some sample code, please.


XSL :
<xsl:template name="padleft">
     <xsl:param name="src"/>
     <xsl:param name="len"/>

     <.????? How to pad spaces to $src to make it a $len longed text
????????>


</xsl:template>

Many Thanks in advance




 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.