[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

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)
href command line parameters
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
generate-id().

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

sebastian


<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">
 <html> 
 <head>
 <title></title>
 </head>
 <body>
 <ul>
 <xsl:for-each select="div1">
 <xsl:variable name="divname" expr="concat(generate-id(),'.html')"/>
  <li><a href="{$divname}">
     <xsl:apply-templates select="head"/>
 	</a>
    <xsl:if test="from-descendants(div2)">
    <ul>
     <xsl:for-each select="div2">
     <li><a href="{concat($divname,concat('#',generate-id()))}">
     <xsl:apply-templates select="head"/>
	</a>
     </li>
     </xsl:for-each>
    </ul>
   </xsl:if>
  </li>
 </xsl:for-each>
 </ul>
 </body>
 </html>
 </xsl:param>
 </xsl:call-template>
</xsl:template>

<xsl:template name="write">
  <xsl:param-variable name="contents"/>
  <xsl:param-variable name="file"/>
  <xsl:value-of select="w:write($contents,string($file))"
     xmlns:w="http://www.jclark.com/xt/java/com.jclark.xsl.sax.HTMLFileWriter"
   />
</xsl:template>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.