RE: [xsl] how to make "well-formated" xml file from xslt

Subject: RE: [xsl] how to make "well-formated" xml file from xslt
From: "Gheste, Amit S" <Amit.Gheste@xxxxxxxxxx>
Date: Fri, 27 Feb 2004 13:27:46 -0600
I concur with this as in a practical scenario, the new-line
character is especially troublesome, not worth the pain it creates
across multi-platform and multi-project systems. I would say if you
want to see a well indented output copy the response onto an editor
and use their auto indent feature or just view it off the IE.
But could you clarify as to what your requirement is.



 -----Original Message-----
From: 	G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
Sent:	Friday, February 27, 2004 7:31 AM
To:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:	Re: [xsl] how to make "well-formated" xml file from

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
characters as there are characters in text nodes.  The "formatting"
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
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
what you see already: start every element on a new line.

I counsel my students to only ever use indentation for diagnostics
never for production work because you have no idea what whitespace
is being 
added to your document to achieve the indentation and you may
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.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread