Henry Zongaro worte :
> 
>      I was taking a look at your problem, and I'm not really sure whether 
> this is a bug - the definitions of the indent-amount and indent output 
> properties aren't entirely clear to me, and there doesn't seem to be much 
> in the way of documentation of their intended behaviour (particularly for 
> indent-amount).
> 
>      The DOM tree that results from your sample document contains text 
> nodes interspersed amongst the element nodes that contain whitespace from 
> your document.  The code in the serializer that tries to indent seems to 
> avoid indenting when text nodes have been output.  Your program ends up 
> inserting an element node after the last text node child of the Product 
> element - so when it's output, the </Product> tag has no text node 
> preceding it in the output, and it's the only line affected by the 
> indent-amount you specified.
> 

I agree with your analysis but I feel this behaviour isn't right. In any 
case, I don't think applying indentation only to the end tag of <Product>
element would be the intended/expected behaviour. 

If you have looked into code, it can be found that m_isprevtext is set 
to true in the characters() callback. But i think this shouldn't be done 
for Whitespace text nodes as it prevents indentation from being applied 
for start and end tags. In the given case, since the element <Version> 
is added as the last child of element <Product> (after the whitespace 
text node), the end tag of this element is being indented with the
indent-amount which is definitely not expected.

The solution is that m_isprevtext shouldn't be set to true when the text is 
whitespace.

-Pavani

>      Perhaps someone who's been working on Xalan longer could comment on 
> whether that's the way indent-amount/indent are intended to work.
> 
>      If that is how they're intended to work, you'll probably have to do 
> something to get the whitespace removed from the document (perhaps using 
> xsl:strip-space?)
> 

 
> 
> 
> "Avnish Pundir" <[EMAIL PROTECTED]> wrote :
> 
> Done.. Bug # 10009. See at
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10009
> 
> Thanks
> Avnish
> ----- Original Message -----
> From: "Pavani Mukthipudi" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 19, 2002 8:14 PM
> Subject: Re: indentation with modified docs
> 
> 
> 
> Avnish Pundir wrote :
> >
> > I am having problem while printing edited XML documents. I have a XML
> > document which is already indented properly with spaces. Now I am 
> parsing
> > the document and adding a few new child nodes to it. But when I print 
> the
> > document, indentation doesn't work out properly.
> > ...
> > I am getting this output
> > <Inventory_Attributes>
> >  <Products>
> >   <Product name="my_product">
> >    <Version>A</Version>
> >    <Version>B</Version>
> >    <Version>C</Version>
> >   <Version>Newly_added_product</Version>
> >   </Product>
> >  </Products>
> > </Inventory_Attributes>
> >
> 
> Seems to be a bug in Xalan because indentation is not really applied in 
> this
> case. Please report it in the bugzilla. I'll provide a patch for it.
> 
> -Pavani
> 

-- 

Pavani Mukthipudi
Sun Microsystems, Inc.

Phone: 91-80-2298989/87390

Reply via email to