Re: [xsl] Whitespace between nodes

Subject: Re: [xsl] Whitespace between nodes
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 13 May 2004 12:16:40 -0400
Nick,

At 10:45 AM 5/13/2004, you wrote:
Again, apologies - it was not frustration at the respondents not giving me what I wanted, but that after a few replies came in I realised my question had been misunderstood, primarily because of lack of detail on my part (sorry!). So I responded to fill in the gaps and explain the question better.

There's no need at all to apologize.


Bottom line is you are in an area which is neither fully specified (XSLT is primarily concerned with tree-manipulation and tree-building, and how the output should be serialized for different output methods can be tricky; nor does XSLT 1.0 have an XHTML output method as you've seen) nor one that can be, perhaps, since it impinges on aesthetic as well as functional issues (people can get worked up about how many spaces should be indented, on the one hand; on the other, an algorithm to determine what's "significant" whitespace that should not be trimmed, or where whitespace may be added without affecting what is "significant", has to make assumptions that may not be warranted in the general case).

When writing XML output I've sometimes felt it necessary to resort to a pipelining approach, not dissimilar from what Andreas suggested. Have your transform write out XML with no indenting; then have a second transform to pretty up the output -- but not (quite) an identity transform with indent="yes", rather a near-identity transform that just adds whitespace where you want it (and only there).

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread