RE: [xsl] Using XSL to create interactive web page from XML

Subject: RE: [xsl] Using XSL to create interactive web page from XML
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 1 Dec 2007 15:29:39 -0000
The XSLT processor in IE is an XSLT 1.0 processor, so it doesn't support
xsl:result-document. To create multiple documents using IE you need to run
one transformation for each output document required, passing some kind of
paramter to indicate which document to create on each run.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Furst, Tom [mailto:tom.furst@xxxxxxxx] 
> Sent: 01 December 2007 14:37
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Using XSL to create interactive web page from XML
> 
> I ran this on saxon, and see the created html files, and they 
> are exactly what I needed.  When I attempted running this in 
> IE to see how the page looked, the browser returned "Keyword 
> xsl:for-each may not contain xsl:result-document." Is there a 
> way around this? Thanks so much for all of your help with this.
> 
> -----Original Message-----
> From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
> Sent: Saturday, December 01, 2007 9:23 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Using XSL to create interactive web page from XML
> 
> Furst, Tom wrote:
> 
> > Using XSLT 2.0 is not required.  But if it will make resolving this 
> > problem any easier to accomplish, or for me to understand, 
> I'm all for 
> > it.
> 
> If you want to display details in a separate iframe then you 
> need to generate additional result documents to be displayed 
> in the iframe. For that you need to use xsl:result-document 
> which is only supported in XSLT 2.0. (Or you would need to 
> use XSLT 1.0 with a processor that has an extension to create 
> additional documents.)
> 
> Here is an example stylesheet using xsl:result-document to 
> create additional documents to be rendered in the iframe. It 
> is an adaption of your original stylesheet, you might want to 
> refactor it later based on the comments already posted on the list.
> 
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 
> <xsl:template match="/">
> <html>
> <head>
> 
> <style type="text/css">
> 
> 
> .linktext {
> font-family: Arial;
> font-size: 9pt;
> font-weight: bold;
> color: black;
> text-decoration: none
> }
> 
> a:visited { text-decoration: none }
> a:hover { text-decoration:none; color: blue; } a:active 
> {text-decoration: none; color:red}
> 
> .header {
> font-family: Arial;
> font-size: 12pt;
> font-weight: bold
> }
> </style>
> 
> </head>
> <body>
> <table style="width:100%">
> <thead>
> <tr>
> <th width="40%" class="header">Symptoms</th> <th width="60%" 
> class="header">Corrective Actions</th> </tr> </thead> <tbody> 
> <tr> <td valign="top"> <table border="0"> <xsl:for-each 
> select="fault-knowledge-base/symptoms/symptom">
> <xsl:result-document href="{@id}.html">
>    <html lang="en">
>      <head>
>        <title>Actions for symptom <xsl:value-of select="@id"/></title>
>      </head>
>      <body>
>        <ul>
>          <xsl:for-each
> select="/fault-knowledge-base/corrective-actions/corrective-ac
tion[@id = current()/corrective-action-ref/@idref]">
>            <li><xsl:value-of select="text"/></li>
>          </xsl:for-each>
>        </ul>
>      </body>
>    </html>
> </xsl:result-document>
> <tr>
> <td><a href="{@id}.html" target="I2" 
> class="linktext"><xsl:value-of select="text"/></a></td> </tr> 
> </xsl:for-each> </table> </td> <td> <iframe name="I2" 
> marginwidth="3" marginheight="3" height="580"
> width="100%" src="about:blank" align="left" frameborder="0"
> scrolling="auto">
> Your browser does not support inline frames or is currently 
> configured not to display inline frames.
> </iframe>
> </td>
> </tr>
> </tbody>
> </table>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> --
> 
>         Martin Honnen
>         http://JavaScript.FAQTs.com/

Current Thread