Subject: Re: [xsl] Result still indented despite indent="no" From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 22 Feb 2005 17:57:29 GMT |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Result still indented des, Mukul Gandhi | Thread | Re: [xsl] Result still indented des, Mukul Gandhi |
Re: [xsl] Result still indented des, Mukul Gandhi | Date | RE: [xsl] Result still indented des, Wendell Piez |
Month |