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

Re: how to make "well-formated" xml file from xslt

Subject: Re: how to make "well-formated" xml file from xslt
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Feb 2004 08:30:32 -0500
well formated xml
At 2004-02-27 03:50 -0800, Ha Nguyen wrote:
I write an xslt file to transform an xml to another
xml file.

The processor is obliged to serialize the result tree without any "formatting" ... that is, it is supposed to put out only as many text characters as there are characters in text nodes. The "formatting" inside of tags is arbitrary.

The output xml file is ugly i.e every tag
are aligned at the same level.

Sounds like your transform must be inserting some newlines of some kind ... I would have expected:


How to make it look like "normal" xml file ?

My teenage daughter has a saying "'normal' is a setting on a dryer" ... I don't believe there is such a thing as a "normal xml file" just as there is no such thing as a "normal teenager".

Did you mean "an indented XML file"?


This is not at all "normal" as it has arbitrary whitespace injected into the document at places where you may or may not expect.

It happens that XSLT offers implementers the option of supporting indentation when the user requests indentation using:

<xsl:output indent="yes"/>

However ... there are no guidelines for the indentation and a processor can do whatever it wants when you ask. The processor is even allowed to do what you see already: start every element on a new line.

I counsel my students to only ever use indentation for diagnostics and never for production work because you have no idea what whitespace is being added to your document to achieve the indentation and you may corrupt downstream processes.

I hope this helps.

...................... Ken

US XSL training: Washington,DC March 15; San Francisco,CA March 22
World-wide on-site corporate, government & user group XML training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc

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

Current Thread


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.
First Name
Last Name
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.