Benoit --

In XalanJ, the default indent amount is zero.  (See
http://xml.apache.org/xalan-j/usagepatterns.html#outputprops).

To get what you want, add the xalan:indent-amount="2" attribute to your
xsl:output element.  You'll need, also, to add a namespace declaration
for the xalan namespace:

  xmlns:xalan="http://xml.apache.org/xslt";

HTH,
Gary

[EMAIL PROTECTED] wrote:
> 
> Hi all,
> 
> This is my XML input :
> 
> <?xml version="1.0"?>
> <topic>
>         <a>Hello</a>
>         <b code="123"/>
>         <c/>
>         <d code="123">
>                 <e>777</e>
>                 <f/>
>         </d>
> </topic>
> 
> and here is my XSL file :
> 
> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
> 
> <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
> <xsl:strip-space elements="*"/>
> 
> <xsl:template match="@*|node()">
>         <xsl:if test="not(self::* and not(node()))">
>                 <xsl:copy>
>                         <xsl:apply-templates select="@*|node()"/>
>                 </xsl:copy>
>         </xsl:if>
> </xsl:template>
> 
> </xsl:transform>
> 
> If I run the SimpleTransform under \xalan-j_2_1_0\samples\SimpleTransform\
> using those files, the output is :
> <?xml version="1.0" encoding="UTF-8"?>
> <topic>
> <a>Hello</a>
> <d code="123">
> <e>777</e>
> </d>
> </topic>
> 
> Why they remove the indentation ?
> With Saxon, it produce really neat output :
> <topic>
>    <a>Hello</a>
>    <d code="123">
>       <e>777</e>
>    </d>
> </topic>
> 
> Any idea ?
> 
> Thanks,
> Benoit Aumars.

Reply via email to