Subject: Re: [xsl] newbie: multiple output files with xsl:document From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 6 Jun 2002 17:42:24 +0100 |
Hi Heather, > Also, just in trying to accomplish this I keep getting parsing errors > under IE 6 such as "Keyword xsl:template may not contain xsl:document." > Here is my silly little xsl file that aims to just make a link and create > another html file, but produces the above error: > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.1"> > <xsl:template match="xbk"> > <xsl:document href="preface.html"> > <html><body bgcolor="#00eeee"><center> > <xsl:apply-templates/> > </center><hr/></body></html> > </xsl:document> > <a href="preface.html">Preface</a> > </xsl:template> > </xsl:stylesheet> You *are* mixed up, but it's not surprising! First, you're using the Microsoft-specific WD-xsl namespace rather than the XSLT namespace. Your namespace declaration (xmlns:xsl attribute) needs to have the value http://www.w3.org/1999/XSL/Transform for MSXML (the processor built in to IE) and other XSLT processors to recognise it as XSLT. (IE6 will try to process the stylesheet anyway, because it still recognises WD-xsl, but no other XSLT processor would.) Second, you're trying to use XSLT 1.1. XSLT 1.1 never got beyond a Working Draft -- over a year ago, the XSL Working Group stopped working on it to start tackling XSLT 2.0. The changes proposed in XSLT 1.1 are supported by a couple of XSLT processors (Saxon and jd.xslt in particular), but not by MSXML. That means that you can't use xsl:document with MSXML. XSLT 2.0, which is a Working Draft at the moment, has a new element called xsl:result-document, which works in much the same way as xsl:document used to. You can use it to create documents of all kinds, in just the same way as you create principal result documents. So if you amended your stylesheet for XSLT 2.0 that would work... if you used a processor that supported the XSLT 2.0 Working Draft, that is. MSXML only supports XSLT 1.0; the only processor that supports any of XSLT 2.0 is Saxon (version 7.1). Some other processors have extension elements to generate multiple result documents, such as redirect:write in Xalan, but those are processor-specific, and MSXML doesn't support any such extension element. So basically if you're using MSXML, you're stuck, I'm afraid -- you have to use a different process to manage the creation of the separate documents, perhaps using a parameter passed into the stylesheet to determine which of the documents gets generated, and managing through code what happens to the results of each of the transformations. (BTW, have a look at the MSXML FAQ at http://www.netcrucible.com/ if you want to know more about the difference between WD-xsl and XSLT.) Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] newbie: multiple output files, Heather Adler | Thread | Re: [xsl] newbie: multiple output f, Mike Brown |
Re: [xsl] Correlation between two x, Joerg Heinicke | Date | Re: [xsl] Correlation between two x, John Sands |
Month |