RE: [xsl] general gripe - html output

Subject: RE: [xsl] general gripe - html output
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 24 Jun 2002 13:05:48 +0100
> When my code looks like this:
> 
> <xsl:template match="/">
>   <html>
>     <body>
>       <br/>
>     </body>
>   </html>
> </xsl:template>
> 
> The processor decides that I really want <br>, because it can 
> see <html>.  If I trick the processor, and take advantage of 
> sloppy html and
> use:
> 
> <xsl:template match="/">
>     <body>
>       <br/>
>     </body>
> </xsl:template>
> 
> It gives me <br/> as I want, because it doesnt know any 
> different.

If you want the output serialized as XML rather than HTML, then use
<xsl:output method="xml"/>.

  But I want to be good, so I'll use:
> 
> <xsl:template match="/">
> <html>
>   <head>
>   </head>
>      <body>
>       <br/>
>     </body>
> </html>
> </xsl:template>
> 
> In which case, I get a nice line inserted as a child of <head>:
> 
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> 
> All well and good, but when I attempt to use html-tidy I get 
> informed of my ill-formed html (</head> in <meta> etc).

What exactly is the processor producing, that html-tidy complains of?
> 
> So what do I do to solve all this helpfulness?
> 
> I use:
> 
> <xsl:output method="xml"/>
> 
> Its a funny old world.
> 

I can't quite see what you're griping about.

Is it that the HTML and XML serializations are different?

Is it that you don't like the rules for choosing a default output method
if you haven't asked for one explicitly?

Is it that you don't like the HTML serialization?

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread