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

Re: formatting xml output: inserting newlines between

Subject: Re: formatting xml output: inserting newlines between generated attributes
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 08 Sep 2003 14:27:00 -0400
formatting xml output
Abie,

At 11:17 AM 9/8/2003, you wrote:
hello,
I want to be able to generate an xml element using <xsl:element/attribute, etc. such that the output xml file has a newline between each attribute. my hunch is that this is impossible in current tools b/c xml is content- rather than display- oriented, but I wanted to at least ask.

Your hunch is correct, though like many hunches, not exactly for the reasons it suspects.


It's impossible not because of the "orientation" of XML as such, but because of the way XSLT's processing model is designed.

Note I infer "current tools" to mean current XSLT tools.

That is, the job is *not* impossible when working outside of XSLT's tree-to-tree conversion model -- more particularly, when working with an application that gives you hands-on access to the document serialization.

Accordingly, the XSLT solution to your problem is to write yourself a serializer (how's your Java? Python?) and hook that in at the end of a transform, instead of using the one your XSLT processor comes with (which isn't designed to work this way). Once you've got your hands in there you should be able to get your XML written however you like (the risk being that it might not be XML when you're done with it).

Alternatively, there are ways to cheat -- for example, you could write a transformation that would output plain text that would "happen to be" XML -- and that would contain the line breaks you wanted.

It would, however, be a nightmare to combine this strategy with a regular every-day transformation, though I can see it being done as a post-process.

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
======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.