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

RE: Filtering files with data

Subject: RE: Filtering files with data
From: "Morgan, Corey" <CMorgan@xxxxxxxxx>
Date: Mon, 20 Oct 2003 13:48:51 -0600
corey morgan
Hello.

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"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:redirect="org.apache.xalan.lib.Redirect"
    extension-element-prefixes="redirect"
    exclude-result-prefixes="redirect">

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

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

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

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

</xsl:template>

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

 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.