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 July 24th, 2008, 06:21 AM
Authorized User
 
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can i trim space using XSLT?

How can i trim value of isa01 if value is like " " and how can i validate value?
<xsl:template match="XTag">
<FileHeader ISA01Name="{ISA/@ISA01}" ISA02Name="{ISA/@ISA02}" GS01Name="{GS/@GS01}" Gs02Name="{GS/@GS02}" />
</xsl:template>


i Appreciate your quick response.

Thanks
 
Old July 24th, 2008, 09:40 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

To trim space, use the normalize-space() function.

You'll have to explain your validation requirements more carefully, I don't know what you mean.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 25th, 2008, 01:34 AM
Authorized User
 
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for ur reply.
But Can you explain me how can i use normalize space function to solve my problem.
Actually i m novice and dont know abt XSLT Syntax.
and i was talking abt validation means if value Of ISA01 will be up to 5 character length, value of ISA02 only in digits etc.



Quote:
quote:Originally posted by mhkay

 To trim space, use the normalize-space() function.

You'll have to explain your validation requirements more carefully, I don't know what you mean.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 25th, 2008, 02:20 AM
Authorized User
 
Join Date: Jun 2008
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mitali,

hope this http://www.w3schools.com/Xpath/xpath...ons.asp#string will help you.

mods,
Can i post such url here?



 
Old July 25th, 2008, 03:58 AM
Authorized User
 
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks.
I think yes..


Quote:
quote:Originally posted by akentanaka
 Hi Mitali,

hope this http://www.w3schools.com/Xpath/xpath...ons.asp#string will help you.

mods,
Can i post such url here?



 
Old July 25th, 2008, 03:15 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>But Can you explain me how can i use normalize space function to solve my problem.
Actually i m novice and dont know abt XSLT Syntax.

You can use normalize-space() within an XPath expression in the same way as you use any other XPath function.

Sorry, but if you don't know how to use XPath expressions within an XSLT stylesheet, then you really need to get a good book and do some reading. Forums are useful when you get stuck on specific questions, but they aren't the way to get started.

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Blank Space in XSLT Prabhakar XSLT 3 April 9th, 2012 02:29 PM
XSLT TRIM Function sagrock XSLT 1 November 23rd, 2007 08:39 AM
Trim MathLearner VB Databases Basics 2 May 16th, 2007 11:38 PM
Strangely working XSLT function normalize-space() seetaramayya XSLT 2 April 23rd, 2007 06:26 AM
TRIM WHITE SPACE vickr1z SQL Language 3 January 12th, 2007 12:39 AM





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