output formated text with xalan?

E

Elhanan

hi..

i don't exactly how to calls this , but is there a property for xalan,
to output xml with crarriage return?

i'm trying out xslt and the output can't be read with a normal editor,
i know when serliaze xml with java, you can place a parameter saying
the xml string will be output in human readble form.
 
J

Joseph Kesselman

Elhanan said:
i don't exactly how to calls this , but is there a property for xalan,
to output xml with crarriage return?

xsl:eek:utput's intent attribute, possibly plus the xylem-specific
xalan:indent-amount attribute for that element.

Warning: The reason XSLT doesn't do this by default is that it may
change the meaning of the document. Excercise appropriate care in using it.
 
J

Joseph Kesselman

Joseph said:
xsl:eek:utput's intent attribute, possibly plus the xylem-specific
xalan:indent-amount attribute for that element.

Oops. Of course, "intent" should have been "indent"; apologies.

The other solution, of course, is to write your stylesheet so it
explicitly outputs whitespace at the desired places, eg via
<xsl:text>
</xsl:text>
That has the advantage of being a lot more controllable than the indent
directive (and more reliable, since different processors may interpret
indent in somewhat different ways), but is more work for the stylesheet
writer.
 
E

Elhanan

how can whitespace between elements change the meaning of the docuemnt?


anyway all i wanna is to able to read it when i deubg.
 
J

Joe Kesselman

Elhanan said:
how can whitespace between elements change the meaning of the docuemnt?

There is no "between". All whitespace is contained within an element,
and is part of that element's contained text. Depending on how your
particularly markup language is being processed, and depending on what
hints you give it (eg the xml:space directive, or schema information
about the intended type), the system may be able to ignore the
whitespace ... or may not.
anyway all i wanna is to able to read it when i deubg.

For debugging, no problem, as long as you're aware that what you're
seeing isn't exactly what other programs are seeing.

For feeding it to another application, the only simple answer is It Depends.

As long as you're aware of that, go for it.
 
P

Peter Flynn

Elhanan said:
how can whitespace between elements change the meaning of the docuemnt?

Because (depending on its context) it may be ignored or retained at
processing time. This may make some data run together or be kept
apart.

See the FAQ: http://xml.silmaril.ie/authors/whitespace/
anyway all i wanna is to able to read it when i deubg.

That may be all *you* want to do, but a machine doesn't have your
eyes. All it can do is obey the markup and the rules of XML. That's
why it's got to be correct. Just "looking OK" isn't enough.

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top