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 April 22nd, 2007, 11:58 PM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strangely working XSLT function normalize-space()

        I am using one xslt to transform one input xml to another xml. In that xslt to truncate spaces (ltrim and rtrim) I am using normalize-space () method. The same xslt is used to transform the two types of input xmls. For one xml it’s truncating the spaces but for the other it’s not doing that. Why it’s strangely working?

    Its working fine in windows environment but it’s failing in Solaris environment.

Thanks in advance. Its urgent fix can any one help me please.

Here is my code:
<test><xsl:value-of select="normalize-space(/*//a/b/testvalue)"/>
                                                </test>



[u]First.xml</u>

<root>
<a>
<b>
<testvalue>562 </testvalue>
</b>
</a>
</root>

[u]Out put (Here space has been truncated)</u>
<test>562</test>


[u]Second.xml</u>

<root>
<a>
<b>
<testvalue>210 </testvalue>
</b>
</a>
</root>

[u]Out put (Observe space after 210)</u>
<test>210 </test>

 
Old April 23rd, 2007, 05:52 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

I would check your XPATH:

<xsl:value-of select="normalize-space(/*//a/b/testvalue)"/></test>

for the second XML file. The path might be different...





 
Old April 23rd, 2007, 06:26 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Perhaps the space isn't actually a space character but something else that looks like a space, for example a non-breaking space xA0?

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
Using normalize-space() eg. with position() Smirre XSLT 5 November 11th, 2008 12:30 PM
How can i trim space using XSLT? Mitali XSLT 5 July 25th, 2008 03:15 PM
space is not working.. gantait XSLT 5 February 26th, 2007 04:39 AM
normalize-space() gantait XSLT 0 February 26th, 2007 03:29 AM
Normalize-space() not working AForgue XSLT 4 December 5th, 2003 12:39 PM





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