Subject: Re: [xsl] Understanding why <tag></tag> is the way it is (was Re: [xsl] IE Client side transformation issue) From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx> Date: Fri, 3 Aug 2007 22:58:02 +0200 |
On 03/08/07, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: > At 2007-08-03 20:37 +0200, you wrote: > >On 03/08/07, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: > > > At 2007-08-03 19:19 +0200, Manfred Staudinger wrote: > > > >On 03/08/07, Abel Braaksma <abel.online@xxxxxxxxx> wrote: > > > > > There is a cdata-section-elements on xsl:output, but not a > > > > > never-minimize-elements attribute or something similar. > > > >There is no need for such an attribute, because MSXML3 handles > > > >the two cases differently. If you specify in your stylesheet > > > ><div style="display: none"/> it becomes <div style="display: none" /> > > > >(invalid html) > > > >but > > > ><div style="display: none"></div> becomes <div style="display: > > none"></div> > > > >in the output. > > > > > > > >Note that there is _no_ need to using nbsp or xsl:comment to ensure > > > >valid html ! > > > > > > I disagree with your summary above based on my own experiences that > > > when using the HTML serialization with MSXML and other tools. The > > > distinction you make is for XML serialization, not for HTML > > > serialization. > >Speaking only about serialization with MSXML this holds for both xsl:output > >methods, XML and HTML. Why do you think its different for HTML? > > Because I demonstrated it in the earlier email ... copied below ... > look at the end result ... manfred1.xsl uses method="html" and > manfred2.xsl uses method="xml" and the serialization by MSXML is > demonstratively different. Sorry yes, I should have seen this, thanks. The difference to my results (see below) is here: > t:\ftemp>type manfred.xsl > <?xml version="1.0" encoding="US-ASCII"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > > <xsl:output method="html"/> > > <xsl:template match="/"> > <body> > <div style="display: none"></div> > <div style="display: none"/> > </body> > </xsl:template> > > </xsl:stylesheet> > t:\ftemp>xslt-msxsl manfred.xsl manfred.xsl con > <body> > <div style="display: none"></div> > <div style="display: none"></div> > </body> In my test the last div is serialized as <div style="display: none" /> ! > Why do you think the serialization by MSXML of the two is the same? My turn, sure. I've set up a test at http://test.rudolphina.org/Test_IE_Ken.xml with a PI for http://test.rudolphina.org/Test_IE_vKen.xsl (method html). You will find the two div's at the very end of the stylesheet and when I display it with IE 6 and view the xsl output, I see the second div is in compact format. The same xsl, but with xsl:output method xml may be invoked by http://test.rudolphina.org/Test_IE.xml which has a PI for http://test.rudolphina.org/Test_IE_view.xsl and gives the same result as yours: > t:\ftemp>xslt-saxon manfred.xsl manfred.xsl con > <body> > <div style="display: none"></div> > <div style="display: none"></div> > </body> > t:\ftemp>type manfred2.xsl > <?xml version="1.0" encoding="US-ASCII"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > > <xsl:output method="xml" indent="yes"/> > > <xsl:template match="/"> > <body> > <div style="display: none"></div> > <div style="display: none"/> > </body> > </xsl:template> > > </xsl:stylesheet> > t:\ftemp>xslt-msxsl manfred2.xsl manfred2.xsl con > <?xml version="1.0" encoding="UTF-16"?> > <body> > <div style="display: none"></div> > <div style="display: none" /> > </body> Thinking about possible causes, what version of MSXML do you use? Thanks a lot, Manfred
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Understanding why <tag></, G. Ken Holman | Thread | Re: [xsl] Understanding why <tag></, G. Ken Holman |
Re: [xsl] translate to XML using XS, Steve | Date | [xsl] Text Overflows Margin Bottom, Horace Burke |
Month |