Hi All,
I'm afraid "xalan:indent-amount" will not work for "text" output method and
especially for Xalan 1.2.2 (I believe it's Xalan 2.X feature). Then your
output corresponds to your XML/XSL according to XML and XSLT specifications.
In the fragment
<output>
ChildName childvalue
GrandChildName grandchildvalue
</output>
" childvalue" was output with one space before, which goes from source XML
file. If you need to put spaces before "ChildName" and "GrandChildName" you
have to designate them explicitly as this is TEXT output. It probably will
look like:
<xsl:text>
 ChildName </xsl:text><xsl:value-of
select="childelement"/>
Thanks,
Dmitry
-----Original Message-----
From: Shane Curcuru [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 31, 2001 05:02
To: [EMAIL PROTECTED]
Subject: Re: XSL output method="text" and indent preservation
Actually, this is a perfect question for the new xalan-j-users list,
instead of this xalan-dev list...
Thanks Bjoern for providing the answer. Sorry about the frequent
confusion on indenting output! Briefly: adding extra spaces to the
output slows down the serialization, so as an optimization, we set the
default indent-amount to 0, and put in the nifty xalan:indent-amount
attribute on the xsl:output. Having this separately settable does make
sense, since (esp. for readable XML) you can specify indenting, which
will put in newlines, but leave the indent-amount off, which will be a
little faster than actually indenting more spaces.
- Shane
-----------
> Hi,
> I am trying to convert an XML document to a text document. While
> converting, I would like to preserve the indentation from the xml
> source file. I am using Xalan(1.2.2). The code snippet to convert
> the XML to TEXT is as follows.
...
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
version="1.0">
<xsl:output method="text"
indent="yes"
xalan:indent-amount="2"/>
=====
<eof aka="mailto:[EMAIL PROTECTED]"
quote="Odo: [You'd shoot a man in the back?]
Garak: [Well, it's the safest way, isn't it?]"/>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/