Re: [xslt] Indentation with <xsl:output method="xml" indent="yes"/>



On Mon, Feb 14, 2005 at 06:41:04PM +0100, Vincent Lefevre wrote:
> On 2005-02-14 11:59:19 -0500, Daniel Veillard wrote:
> > On Mon, Feb 14, 2005 at 02:35:01PM +0100, Vincent Lefevre wrote:
> > > I wonder why I don't get the same form as with xmllint --format:
> > 
> >   because the serialization code is extremely cautious about
> > the formatting option and tend to just stop it if there is any
> > text node left as a sibling, while those text nodes are stripped
> > out on input with xmllint --format.
> 
> This is OK for me, but is it required by the XSLT specification?
> For instance, Sablotron and Xalan don't have the same behavior.

  nothing really normative here. check the spec by yourself :-)
   http://www.w3.org/TR/xslt#section-XML-Output-Method

"If the indent attribute has the value yes, then the xml output method
may output whitespace in addition to the whitespace in the result
tree (possibly based on whitespace stripped from either the source
document or the stylesheet) in order to indent the result nicely; if the
indent attribute has the value no, it should not output any additional
whitespace. The default value is no. The xml output method should use an
algorithm to output additional whitespace that ensures that the result if
whitespace were to be stripped from the output using the process described
in [3.4 Whitespace Stripping] with the set of whitespace-preserving
elements consisting of just xsl:text would be the same when additional
whitespace is output as when additional whitespace is not output."

 "nicely" is not defined :-)
 and not adding any space is also a conformant behaviour, you can just
argue about the "nicely" adjective, could be one space, 2 spaces,
4 spaces, one tab, 4 tabs, whatever really ... libxml2 is just being
conservative in its processing.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]