Re: [xsl] Indent?

Subject: Re: [xsl] Indent?
From: Joseph Kesselman <keshlam@xxxxxxxxxx>
Date: Fri, 23 Jul 2004 09:00:57 -0400
Accoding to the XSLT spec, indent is considered a hint to the serializer,
and the exact results are not specified. There are rules saying where you
can't introduce whitespace, but no requirement that you do so in all the
places it's allowed, nor how much. Implementation dependent.

Xalan *does* support indentation... but our default indentation-per-level
is 0; we generate only the line-breaks. To get actual structural
indentation, you need to say how much you want, using a Xalan-specific
directive; see

Yes, this is nonportable (though it's harmless to other processors) -- but
as I said above, indent's behavior is nonportable. If you want predictable
whitespace, your stylesheet has to generate that itself, using xsl:text
directives. That's just the nature of the beast, I'm afraid.

(We can argue -- and have argued many times! -- about whether 0 is the
right default for per-level indentation. I've become completely agnostic on
that issue, since no matter what value you pick someone always screams.)

Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk

Current Thread