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(_at_)CraneSoftwrights(_dot_)com
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