RE: [xsl] Filtering files with data

Subject: RE: [xsl] Filtering files with data
From: "Morgan, Corey" <CMorgan@xxxxxxxxx>
Date: Mon, 20 Oct 2003 13:48:51 -0600

I'm not clear on how you wish to partition your output into various output
files, or what they are to be named, but I'll assume that you want to create
a seperate .doc file using the @name attriibute of each <llnode> element.

There are a number of ways to go to generate seperate files.  In a
production environment, we'll control the input and output externally.  The
pipelines in Cocoon, for example, you can use an xpath expression to extract
the particular <llnode> that you want, and then direct that output to
whereever you want.

Saxon, Xalan, and other XSL 1.0 drivers have extensions for redirecting your
generated output to different files.  The following sample is using Xalan's
org.apache.xalan.lib.Redirect class to create a different .doc file for each
<llnode>.  The "primary" document would just be a log of what's been
created, of the form:

Creating file lindgre2.doc
Creating file lindgre3.doc

Hope this helps.
Corey Morgan

--- snip begin
<xsl:transform version="1.0"

    | Processes nodes of this form:
    | <livelink><llnode name="some doc name">...

<xsl:template match="livelink//llnode">

    <xsl:variable name="file-name">
        <xsl:apply-templates select="./@name" />

    <xsl:text/>Creating file <xsl:value-of select="$file-name" />.
    <redirect:write file="$file-name">
        <xsl:apply-templates select="." mode="doc-file" />


<xsl:template match="llnode" mode="doc-file">
--- snip end

 XSL-List info and archive:

Current Thread