Subject: How can i trim space using XSLT?
Posted By: Mitali Post Date: 7/24/2008 6:21:11 AM
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

Reply By: mhkay Reply Date: 7/24/2008 9:40:00 AM
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
Reply By: Mitali Reply Date: 7/25/2008 1:34:43 AM
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:
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



Reply By: akentanaka Reply Date: 7/25/2008 2:20:23 AM
Hi Mitali,

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

mods,
Can i post such url here?   



Reply By: Mitali Reply Date: 7/25/2008 3:58:28 AM
Thanks.
I think yes..


quote:
Originally posted by akentanaka

Hi Mitali,

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

mods,
Can i post such url here?   







Reply By: mhkay Reply Date: 7/25/2008 3:15:32 PM
>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

Go to topic 73002

Return to index page 1