RE: [xsl] Re: XSL to ODF/OOXML

Subject: RE: [xsl] Re: XSL to ODF/OOXML
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Thu, 25 Oct 2007 15:29:55 -0500
But you're trying to transform that HTML output again? That seems to be
your problem here - HTML isn't XML, so you can't use XSLT to do that.
However, since you are using an intermediary in the process (the HTML
document), you can do this. Transform the original file into HTML the
same way you're doing it now, but use <xsl:output method="xml"/>, and
store it in a temporary file or variable. When you need to output the
HTML report to the browser, run it through this stylesheet:

<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform";>
  <template match="@*|node()">
    <copy>
      <apply-templates select="@*|node()"/>
    </copy>
  </template>
</stylesheet>

Since the root element of your XML document is <html>, the XSLT
processor will determine that it should use <xsl:output method="html"/>
in that stylesheet. Then, after you've decided what you want to do with
your HTML result, you can still transform the intermediate XML document
to any other format you'd like. (ODF, OOXML, etc)

~ Scott


-----Original Message-----
From: Steve [mailto:subsume@xxxxxxxxx]
Sent: Thursday, October 25, 2007 3:21 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Re: XSL to ODF/OOXML

I can't do method="xml" because I need the stylesheet to output html
because its an html report. Does this matter? If so, workaround?

-Steve

On 10/25/07, Scott Trenda <Scott.Trenda@xxxxxxxx> wrote:
> Robert's right here - are you using the literal stylesheet syntax to
> convert it the first time around, like this?
> <html xsl:version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>   ... content ...
> </html>
>
> If so, the processor is automatically choosing <xsl:output
> method="html"/>, because the root element of the result document has a
> name of "html". Expand that stylesheet out to its full syntax
> (<xsl:stylesheet etc.), put in <xsl:output method="xml"/>, and you
> should be fine.
>
> ~ Scott
>
>
> -----Original Message-----
> From: Robert Koberg [mailto:rob@xxxxxxxxxx]
> Sent: Thursday, October 25, 2007 2:37 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Re: XSL to ODF/OOXML
>
> Do you have an <xsl:output method="xml"/> ?
>
>
> On Thu, 2007-10-25 at 14:34 -0400, Steve wrote:
> > I was noticing that.
> >
> > What's strange is in my xsl these link tags are closed, however,
> > post-transform they are open. After all, these link tags are the
> > result of a transform so obviously they were compliant to begin
with.
> >
> > Any idea why MSXML is doing this?
> >
> > On 10/25/07, Robert Koberg <rob@xxxxxxxxxx> wrote:
> > >
> > > On Thu, 2007-10-25 at 14:06 -0400, Steve wrote:
> > > >
> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > > > <html xmlns:msxsl="urn:schemas-microsoft-com:xslt">
> > > >     <head>
> > > >          <META http-equiv="Content-Type" content="text/html;
> > > > charset=ISO-8859-15">
> > > >           <title>Database</title>
> > > >           <script
> src="../master/Global/prototype-1.6.0_rc0.js"></script>
> > >
> > > You might need the script like <script>//</script>
> > >
> > > >           <link rel="stylesheet" media="print"
> > > > href="../master/Global/print.css">
> > >
> > > Maybe this was a typo, but you haven't closed the link...
> > >
> > > best,
> > > -Rob
> > >
> > > >      </head>
> > > > <body>
> > > >         .... blah blah ....
> > > > </body>
> > > > </html>

Current Thread