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

Using Saxon 8.5 and collection() to process a director

Subject: Using Saxon 8.5 and collection() to process a directory of XML fi les
From: "Welch Andrew (ELS)" <A.Welch@xxxxxxxxxxxx>
Date: Thu, 4 Aug 2005 13:08:25 +0100
 Using Saxon 8.5 and collection() to process a director
I've just had a requirement to process a directory of XML files, generating
10 output files per source XML file and placing them in a folder named the
same as the input file.  Mike mentioned in his annoucement email for Saxon
8.5 something along these lines, so I want to try and achieve it all in a
single stylesheet, rather then needing the host language.

So, given a folder of source XML files:

001.xml
002.xml
...
999.xml

The result of tranform should be a folder per XML file, named the same as
the XML file, with the 10 ouput files within it:

[001] <- folder
  first.html
  second.html
  ...
[002]
  first.html
  second.html
  ....

...
[999]
  first.html
  etc

I believe it's possible now to use the collection() function to get a
sequence of the input XML files.  Is it possible to get the filenames so
that I can create the corresponding output folder?

This is the code I think I need once I have the collection bit sorted (which
will wrap this code):

<xsl:for-each select="for $i in $outputFileNames return $i">
    <xsl:result-document href="{$dir}/{$folderName}/{.}.html">
        ....	
    </xsl:result-document>
</xsl:for-each>

$outputFileNames is the sequence of the 10 filenames eg 'first', 'second'
and so on.  $dir is the output folder.  $folderName needs to come from the
filename of the input XML - not sure if this is possible yet.

Once this is ready, I think the end user should be able to run this
stylesheet (with the correct path parameters but without any input XML) to
generate all of the necessary files.  It would be great to do all this in
the stylesheet, rather than requiring the host language to perform each
transform separately.

My question is - is this possible?

cheers
andrew

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.