[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Result still indented despite indent="no"

Subject: Re: Result still indented despite indent="no"
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 20 Feb 2005 18:12:43 +1100
xalan white spaces
On Sat, 19 Feb 2005 22:55:03 -0800 (PST), Mukul Gandhi
<mukul_gandhi@xxxxxxxxx> wrote:
> Hi Ken,
>  I tested white space handling by Saxon 8.1.1(in XSLT
> 1.0 mode) , Xalan-J 2.6.0 & MSXML4. I took the XML
> example provided by Dare Obasanjo in xml-dev post, and
> the XPath expression he posted..
> 
> The XML is -
> <pre>
>  <b>bold</b>
>  <i>italic</i>
> </pre>
> 
> The XPath expression is -
> count(/pre/child::node())
> 
> Saxon gives result - 5
> 
> MSXML4 gives result - 2
> 
> Xalan-J 2.6.0 gives result - 5
> 
> The XSLT 1.0 spec(URL -
> http://www.w3.org/TR/1999/REC-xslt-19991116) says
> (section 3.4 Whitespace Stripping)
> 
> "After the tree for a source document or stylesheet
> document has been constructed, but before it is
> otherwise processed by XSLT, some text nodes *are*
> stripped.
> 
> A text node *is preserved if any of the following
> apply*:
> 
> 1) The element name of the parent of the text node is
> in the set of whitespace-preserving element names.
> 
> 2) The text node contains at least one non-whitespace
> character. As in XML, a whitespace character is #x20,
> #x9, #xD or #xA.
> 
> 3) An ancestor element of the text node has an
> xml:space attribute with a value of preserve, and no
> closer ancestor element has xml:space with a value of
> default.
> 
> Otherwise, the text node *is* stripped. "
> 
> There seems no ambiguity, that in this example
> (provided by Dare Obasanjo) - white spaces *must* be
> stripped (as none of the above 3 conditions in spec
> are holding true).
> 
> It seems to me, MSXML4 is compliant in this regard. I
> fear, Saxon and Xalan are not compliant..
> 
> Also, I feel what the spec recommends in this
> regard(white space stripping) is correct..
> Unless the user explicitly gives instruction to
> preserve white spaces, they should be stripped. *White
> space only, text nodes* are of no use for application.
> 
> Regards,
> Mukul


It's better not only to "feel", but also to read well.

The spec also says just a few lines further:

"Initially , the set of whitespace-preserving element names contains
all element names."

This, combined with rule 1) means that your conclusion is contrary to
the rules established by the XSLT 1.0 spec.

BTW, the exact link to the discussed rules is:

           http://www.w3.org/TR/1999/REC-xslt-19991116#strip


Cheers,
Dimitre Novatchev.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.