[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: "Gheste, Amit S" <Amit.Gheste@xxxxxxxxxx>
Date: Fri, 27 Feb 2004 13:27:46 -0600
well formated xml
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.

Regards

AmitGhaste


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

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.
>Ex:
><Diagram>
><Graph>
><Node>
>....
></Node>
></Graph>
></Diagram>

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

<Diagram><Graph><Node>....</Node></Graph></Diagram>

>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"?

<Diagram>
   <Graph>
     <Node>
       ....
     </Node>
   </Graph>
</Diagram>

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



 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.