[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: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 22 Feb 2005 17:57:29 GMT
ws.xml
> David, if you agree with my understanding, we may
> close this thread.

I think we should close it anyway;-)

> If MSXML4 is able to run in IE by default, we'll get
> desired behaviour.. This we can wish, will happen in
> future versions of IE.

the behaviour you describe was exactly the same  before msxml4 came out,
if you use msxml3 outside IE you can get the right behaviour.
It is all about whether IE allows you to set the whitespace property, not
about whether it uses msxml3 or 4 (but I said this before)

Of course to simplify things a bit (and in a vain attempt to close this
thread earlier) I lied to you about msxml's white space behaviour,
it doesn't _completely_ remove all trace of the white space nodes that
it drops: it remembers where they were (although not, I think, exctly what
space was there) and sometimes, if it feels like it, it tries to
re-insert the nodes.

So you get the following beghaviour which clearly incontrovertibly
does not comply to the XSLT spec. There is no input tree that can
validly produce the output that you get below, from a slightly modified
version of your test files.

If you save the folling xml and xsl as ws.xml and ws.xsl respectively
then 

in firefox you get a count of 5 and the two ways of doing an
identity transform produce the same result.
the white space (including a newline) is rendered in the pre element so
you get bold and italic on separate lines.

In IE you get a count of 2 and the second identity transform  (using
apply-templates) shows spaces have been dropped as we have discussed,
but if you use copy-of as in the first identity transform the white
space nodes come back by magic, but not as a newline, just as a space
so you get bold and italic on the same line separated by a space.

Basically if you construct the node list "by hand" using apply-templates
then the result tree doesn't have any of the magic markers but if you
copy a whole node then white space markers in its descendants get copied
and when these are serialised they do (in some circumstances) generate
white space in the result tree. 

David



<?xml-stylesheet type="text/xsl" href="ws.xsl"?>
<pre>
  <b>bold</b>
  <i>italic</i>
</pre>




<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">


<xsl:template match="/">
<html>
<head/>
<body>
<p>
count:  <xsl:value-of select="count(/pre/child::node())"/>
</p>

<p>identity 1:</p>
<xsl:copy-of select="."/>

<p>identity 2:</p>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.