This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Strip CRLF/newline only
- To: <xsl-list at lists dot mulberrytech dot com>, <Peter dot Hunsberger at stjude dot org>
- Subject: RE: [xsl] Strip CRLF/newline only
- From: "Robert C. Lyons" <boblyons at unidex dot com>
- Date: Wed, 24 Oct 2001 16:19:23 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
Peter,
The xsl:strip-space instruction should do the trick.
For example, the following identity transformation
strips the whitespace that you don't want:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="no"/>
<xsl:strip-space elements="*"/>
<!-- Identity transformation. -->
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Hope this helps.
Bob
<sig name = 'Bob Lyons'
title = 'B2B Integration Consultant'
company = 'Unidex, Inc.'
phone = '+1-732-975-9877'
email = 'boblyons@unidex.com'
url = 'http://www.unidex.com/'
product = 'XML Convert: transforms flat files to XML and vice versa' />
-----Original Message-----
Up until now I've watched the white space issues bounce around wondering why
it's a problem, now I've got a whitespace issue I'm not having a lot of luck
with....
I have a bunch of XML formatted with CRLF (newlines) to make the XML look
pretty, e.g.:
<person>
<name>
<last/>, <first/>
</name>
<dateofbirth/>
<address>
<addr1/>, <city/>, <state/>
</address>
</person>
In the text nodes there are significant spaces (the ones following the
commas) that I want to preserve. I don't want the extension to see the
newline/CRLF's. I assume this is a filter, but what's it look like?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list