Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
2.6
-
Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
-
None
-
Operating System: Solaris
Platform: Sun
-
30622
Description
I'm converting an input XML file into an output XML file using 'java
org.apache.xalan.xslt.Process". Some of the input XML elements are output as
is, some are modified, and some new ones are introduced via the XSL style sheet
using xml:element. All elements which are pased through as is or are modified
appear to be indented as expected. However, elements created via xsl:element do
not appear to be indented correctly: the opening tag appears to always be
indented, but all subelements created after that and the closing tag are not
indented at all.
This is not inducing any errors downstream; it only makes the file more
difficult for people to read.
Probably working as designed.
Copied stuff is undoubtedly including whitespace from the source document rather
than being indented by Xalan.
Xalan-generated indentation defaults to line-break only. To actually indent, you
need to specify how much indentation should occur per level, by adding the
attribute xalan:indent-amount="5" (or however much) to your <xsl:output> directive.
(Yes, there have been extensive arguments about whether 0 is the best default.
No, I don't think it is. We can bring it up on the mailing list again and see if
anyone has changed their minds...)
This really should be added to our FAQ page!