Re: [xsl] Large Document

Subject: Re: [xsl] Large Document
From: Markus Spath <mspath@xxxxxxxx>
Date: Sun, 16 Mar 2003 09:12:06 +0100
Jack Cane wrote:
Markus,

Not sure where I am supposed to look. I have the XML-SPY app, pro version.
with stylesheet designer, but did not find anything on this subject. Also
looked at the W3C spec for XSL, without success.

outputting to multiple files is not possible with 'pure' XSLT 1.0., so you need to rely on some extension function.


XSLT 2.0 will be able to do it using the <xsl:result-document> element, you can find an example in the draft there (http://www.w3.org/TR/xslt20/).

Saxon 7.+ implements this already, so you could try it.

I can see naming issues. Maybe XSL can look in the XML file for certain
element property names (i.e., chapterheading="Chapter 1."), etc.), and I can
write code that maps section names to file names? Is that how it can work?


[snippet using Xalan splitting at sect1 elements]


<?xml version="1.0" encoding="ISO-8859-1" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0"
                xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
                extension-element-prefixes="redirect">
...

<xsl:template match="sect1">
<!-- assuming sect1 elements have an id attribute -->
<redirect:write select="concat(@id, '.html')">
<html>
  <body>
    <xsl:apply-templates />
  </body>
</html>
</redirect:write>
</xsl:template>

...
</xsl:stylesheet>

Saxon 6 would use <saxon:output> with saxon bound to xmlns:saxon="http://icl.com/saxon";

Maybe you can point me to the best online source?


a nice example for this checking fpr the availability of the extensions can be found in the docbook XSL Stylesheets: http://docbook.sourceforge.net/projects/xsl/
have a look at chunker.xsl in the html diretory.


hth,
Markus



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


Current Thread