Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 17th, 2007, 10:29 PM
Registered User
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default xslt:fill data with dots

lets say in a xml document i have a list of names
for example:
dave
jim
tomy

i select it in xslt with:
<xsl:for-each select="name">

I want to add dots on the left side so total length of word is 6.

so output would be:

..dave
...jim
..tomy

how do i do it?can some one give or guide on the code?
thanx alot.
Tommy


 
Old May 18th, 2007, 03:04 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Depends on whether you want to truncate names longer than 6 chars or leave them as they are. The following code truncates:

substring(concat('.....', $in), string-length($in))

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display 'Empty data' when fill datase cJeffreywang ASP.NET 2.0 Basics 2 August 28th, 2008 11:57 PM
how to fill the combobox with data from different alfiecrosby General .NET 0 May 14th, 2008 10:54 AM
Fill the five record only adapter to data set bhasker_braj121 ADO.NET 0 July 16th, 2007 05:12 AM
Fill data set from data reader sunil menghani ADO.NET 3 March 29th, 2005 07:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.