[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Removing all line breaks in text nodes

Subject: Removing all line breaks in text nodes
From: "Mark Peters" <flickrmeister@xxxxxxxxx>
Date: Sat, 9 Sep 2006 18:09:47 -0400
line break mark
Hi,

When Adobe FrameMaker saves documents as XML files, it seems to break
lines at a defined width.

For example:

<p>This sample text node illustrates how FrameMaker introduces
line breaks at pre-defined widths. If this were a real piece of content,
it would contain interesting or useful information. However it's just an
example paragraph. I'll add one more line here for good measure, and
will then simply quit.</p>

I'd like to remove all line breaks using XSLT 1.0, if possible. The
resulting XML would look like the following:

<p>This sample text node illustrates how FrameMaker introduces line
breaks at pre-defined widths. If this were a real piece of content, it
would contain interesting or useful information. However it's just an
example paragraph. I'll add one more line here for good measure, and
will then simply quit.</p>

I've tried several normalizing templates from Dave Pawson's site
(http://www.dpawson.co.uk/xsl/sect2/normalise.html), such as the
following:

	<xsl:template match="*">
		<xsl:param name="indent" select="'&#xA;'"/>
		<xsl:value-of select="$indent"/>
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates>
				<xsl:with-param name="indent" select="concat($indent, $indent-increment)"/>
			</xsl:apply-templates>
			<xsl:if test="*">
				<xsl:value-of select="$indent"/>
			</xsl:if>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="comment()|processing-instruction()">
		<xsl:copy/>
	</xsl:template>

- and -

<xsl:template match="text()[normalize-space(.)='']"/>

I've also tried removing the line breaks using XMLTidy, without success.

I'd appreciate any suggestions.

Thanks.

Mark Peters
Senior Technical Writer
Saba Software

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.