Subject: RE: Multiple HTML content in XML for Rendering
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 21 Mar 2007 21:32:28 -0000
|
I have no idea what a browser would do if you sent it a file containing two
DOCTYPE declarations each followed by an html element (it would almost
certainly render it somehow, but I've no idea how); but you certainly can't
generate such a file using XSLT's HTML output method.
Handling data like this that contains escaped HTML is probably the only
really justifiable use case for using disable-output-escaping. Find yourself
an XSLT processor that supports this deprecated option, and use it to output
the HTML so that it comes out as <html>...</html> rather than
<html>....</html>. Then send the resulting HTML to a browser;
you can use XSLT with HTML Tidy to turn it into a single HTML page rather
than multiple HTML pages if that's what you want to do.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Senthilkumaravelan K [mailto:skumaravelan@xxxxxxxxxxxxxx]
> Sent: 21 March 2007 21:15
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: Multiple HTML content in XML for Rendering
>
> Hi ,
> Sorry for the inconvenience,I was expecting the o/p as
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html>
>
> <head>
>
> <title> Hello world.</title>
>
> </head>
>
>
>
> <body bgcolor="#FFFFFF">
>
>
>
> </body>
>
> Hello World First HTML
> </html>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
> Transitional//EN"> <html>
>
> <head>
>
> <title>Hello world 2</title>
>
> </head>
>
>
>
> <body bgcolor="#FFFFFF">
> Hello World 2
> </body>
> </html>
> This is the style sheet am trying to achieve the same.
> I am not getting the expected output for the method="HTML"
> Let me know what i need to do get the desired output.
>
> <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet
> version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" indent="yes" />
> <xsl:template match="*">
>
> <xsl:apply-templates />
>
> </xsl:template>
> <xsl:template match="//Content">
> <xsl:apply-templates />
> </xsl:template>
> </xsl:stylesheet>
>
> On 3/21/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > I believe Dijkstra once said you should never start writing
> a program
> > until you knew what output you wanted it to produce. The
> same is true
> > of XSLT. On this list we can help you write a stylesheet to produce
> > any kind of output you want, but if you don't know what output you
> > want, there's little we can do to advise.
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >
> > > -----Original Message-----
> > > From: Senthilkumaravelan K [mailto:skumaravelan@xxxxxxxxxxxxxx]
> > > Sent: 21 March 2007 20:43
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: Multiple HTML content in XML for Rendering
> > >
> > > Hi ,
> > > I have xml which might contain multiple nodes with different HTML
> > > content, How Do I render the information in a browser
> using XSLT ?
> > > Is it possible in first place? Any approach would be helpful.
> > >
> > > My XML would be like
> > > <contents>
> > > <content>
> > > <Content><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
> > > Transitional//EN">
 
 <html>
> <head>
> > > <title>Vielen Dank f|r Ihre Registrierung bei
> > > Apple.</title>
 </head>
 
 <body
> > > bgcolor="#FFFFFF">
 
 </body>
 Hello World
> > > First HTML </html></Content>
> > > <Content><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
> > > Transitional//EN">
 
 <html>
> <head>
> > > <title>Vielen Dank f|r Ihre Registrierung bei
> > > Apple.</title>
 </head>
 
 <body
> > > bgcolor="#FFFFFF">
 
 
 Hello World 2
> > > </body>
 </html></Content>
> > >
> > > There are two content nodes with 2 different HTML content in it.
> > > How this can be rendered as HTML in a browser?
> > >
> > > Thanks,
> > > Senthil
|