[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Batch transform into one file
Gary,
You could go several different ways with this. One approach is simply to use your batch process to concatenate the results of a series of transformations. For example, if you simply had the transform write: <file source="W1L">filename1.xml</file> or <file source="W1S">filename23.xml</file> you could bang these into a single file with your script, wrapping the lot of them in a pair of tags (there are several ways to do that: I might even use a "wrapper" XML calling the list as a parsed entity), and then process that as input to sort your file lists. Another approach is to use the document() function. There are several ways you could do it. Given that you have many files, the easiest way could be to create a "driver" XML that listed them: <set> <file>one.xml</file> <file>two.xml</file> <file>three.xml</file> <file>four.xml</file> </set> (Either create this by hand, write a Perl or Python script, or use any of several available utilities to do it for you, such as XMLStarlet.) Use this file as your input and call document(/set/file) to pull the instances together. For example: <xsl:for-each select="document(/set/file)"> <!-- your context is now the root of each of the documents listed --> <xsl:if test="/wheres/your/@id='W1S'"> <xsl:text>File #</xsl:text> <xsl:copy-of select="/wheres/your/field[@id='4']"/> </xsl:if> </xsl:for-each> But note: this sort of thing can be memory-hungry in XSLT. The best solution depends on factors like how often you need to do this (thus, how neat, clean, portable, scaleable it needs to be), performance constraints etc. I hope this helps, Wendell Hi. I need to alter the stylesheet below to create 1 text file with the data extracted from multiple XML files from a batch transform. Right now it will create 1 text file for each XML file transformed. ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|