Re: [xsl] Removing white space from XML file

Subject: Re: [xsl] Removing white space from XML file
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Wed, 11 Apr 2007 20:21:49 -0500
Hi, Chad,

XSLT has a function to handle at least part of the problem: xsl:normalize-space.

normalize-space removes leading and trailing spaces and reduces any spaces within the value it receives to one space. So, " one two " becomes "one two".

HTH

Jay Bryant
Bryant Communication Services

----- Original Message ----- From: "Chad Chelius" <cchelius@xxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, April 11, 2007 7:25 PM
Subject: [xsl] Removing white space from XML file



I am being supplied an XML file that contains white space in both the value of elements and also in the general structure of the XML file. Most often in the value of each element there are several spaces but sometimes there are other spaces as well. Is there an easy way to remove these? Also, within the value of each element, there needs to be one space instead of several. I know this can be accomplished with a find change in many programs, but it would be great if I could remove these extra spaces using an XSLT.

chad

Current Thread