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

Re: White space strategies for mixed content

Subject: Re: White space strategies for mixed content
From: "Peter Flynn peter@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Nov 2019 15:29:07 -0000
Re:  White space strategies for mixed content
On 05/11/2019 01:00, Rick Quatro rick@xxxxxxxxxxxxxx wrote:
Hi All,

I have inherited some "interesting" xml that has mixed content and I am trying to figure out some strategies for getting "cleaner" output in my XSLT workflow without removing any needed whitespace.

This is a very common problem in handling document XML with significant amounts of mixed content, especially with nested subelements. It's made unnecessarily harder by the dropping of white-space-only nodes (we should have paid more attention to this at the time).


Michael has explained the dropping of insignificant white-space. I don't need that because I'm typically outputting to LaTeX which does that by itself, but I do need the reverse: to reinsert the deleted white-space-only nodes which fall between subelements, eg

...use <tag>foo</tag>, <emph>never</emph> <tag>bar</tag>...

To avoid this, in the template for each element which may occur in mixed content, you could first call a short named template which tests if the immediately-preceding node has a name which is not 'text', and in that case, insert a single space character.

Peter

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.