RE: multiple output files/getting command-line parameters in XT

Subject: RE: multiple output files/getting command-line parameters in XT
From: "Sebastian Rahtz" <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Jul 1999 20:36:22 +0100 (BST)
Mike Brown writes:
 > James Tauber wrote:
 > > What I've started to do lately when producing multiple 
 > > HTML files from a single (possibly large) XML document
 > > is to generate *all* the HTML using XT's extension
 > > mechanism and making the result tree simply a "status
 > > document" (often just output to stdout).
 > Can you provide a short example of how you're doing this?

Suppose your document has a series of <div1> sections, with nested
<div2> sections. The following template makes a summary file called
"main.html" which lists the <div1> titles in a table of contents, and
links them to separate files. A separate template for "div1" would
take charge of starting a new file end naming it according to

This is for XT; Saxon's syntax for the file writing is more
elegant. Do the Lotus and Oracle XSL's have the facility at all?

the demo files split.xsl and slides.xsl in XT demonstrate these things 
rather well


<xsl:template match="/">

 <xsl:apply-templates select="div1"/>

 <xsl:call-template name="write">
    <xsl:param name="file">main.html</xsl:param>
    <xsl:param name="contents">
 <xsl:for-each select="div1">
 <xsl:variable name="divname" expr="concat(generate-id(),'.html')"/>
  <li><a href="{$divname}">
     <xsl:apply-templates select="head"/>
    <xsl:if test="from-descendants(div2)">
     <xsl:for-each select="div2">
     <li><a href="{concat($divname,concat('#',generate-id()))}">
     <xsl:apply-templates select="head"/>

<xsl:template name="write">
  <xsl:param-variable name="contents"/>
  <xsl:param-variable name="file"/>
  <xsl:value-of select="w:write($contents,string($file))"

 XSL-List info and archive:

Current Thread