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 October 13th, 2006, 06:00 AM
Authorized User
 
Join Date: Oct 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Remove the trailing whitespace

 I am trying to remove the trailing whitespace while querying it from the input XML.i Can't use the normalize-space method since it will remove the all the whitespaces (i.e whitespaces between characters)

Please Help me in this!!!

 
Old October 13th, 2006, 06:23 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

normalize-whitespace does not remove all whitespace: it removes leading and trailing whitespace, and replaces internal sequences of whitespace characters with a single space.

In 2.0 you can trim trailing whitespace using

replace($in, "\s*$", "")

(not tested)

In 1.0, I think you'll need to write a recursive template that tests the last character to see if it's a space (substring($in, string-length($in), 1)) and if so, strips it off and recurses.

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 do I keep leading and trailing whitespaces? 2BOrNot2B XSLT 2 October 31st, 2008 11:35 AM
column uniqueness that trim's trailing whitespace? callagga SQL Language 0 July 28th, 2008 09:45 PM
Trailing blanks for 'text' output Neal XSLT 5 May 29th, 2008 06:25 AM
SQL - removing trailing zeros skywalker1981 SQL Server 2000 4 April 1st, 2008 08:32 AM
Remove Leading and Trailing Zeros lene_wee SQL Server 2000 3 April 1st, 2008 08:23 AM





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