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

RE: multiple input files to one output file

Subject: RE: multiple input files to one output file
From: James Garriss <jgarriss@xxxxxxxxx>
Date: Fri, 04 Feb 2000 12:34:30 -0500
xslt multiple input files
LotusXSL 0.19.2 has a very elegant solution for passing parameters into an XSL stylesheet. After instantiating the processor, you call processor.setStylesheetParam to replace a placeholder with some value. Here at MITRE, we replaced a placeholder with a URI of an XML file, thus we were able to access the contents of it directly, just as if it was a variable. This is done pretty much in the same manner as passing a parameter to a template.

Note that we are calling LotusXSL from a Java servlet. Here's the function we used (note that much of this is code right out of the LotusXSL documentation):

***************

public static void transform(String xmlSourceURL, String xslURL, String outputURL, String userDirectoryURL, String userName)
throws java.io.IOException, java.net.MalformedURLException, org.xml.sax.SAXException
{
// Instantiate an XSLTProcessor.
org.apache.xalan.xslt.XSLTProcessor processor =
org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();


  // Set a param named "userdirectory", that the stylesheet can obtain.
  processor.setStylesheetParam("userdirectory", "'" + userDirectoryURL + "'");

// Create the 3 objects the XSLTProcessor needs to perform the transformation.
org.apache.xalan.xslt.XSLTInputSource xmlSource =
new org.apache.xalan.xslt.XSLTInputSource (xmlSourceURL);
org.apache.xalan.xslt.XSLTInputSource xslSheet =
new org.apache.xalan.xslt.XSLTInputSource (xslURL);
org.apache.xalan.xslt.XSLTResultTarget xmlResult =
new org.apache.xalan.xslt.XSLTResultTarget (outputURL);


  // Perform the transformation.
  processor.process(xmlSource, xslSheet, xmlResult);
}

***************

Our stylesheet has this line in it....

<xsl:param name="userdirectory" select="'default'"/>

and the placeholder "default" is what gets replaced. Pretty nifty, eh?

--J

***************

At 02:54 AM 2/2/2000 , Linda van den Brink wrote:
>I've used the document() function before, but this time I don't know the
>paths and filenames of the documents beforehand. These are thousands of
>files in hundreds of different directories.
>
>I do have XML files that specify the filenames and paths of all the
>documents in a specific subdirectory. Could I somehow read such a
>filenames-file and call the document function for each of the files listed,
>and then extract the information I want from each document?
>
>Maybe my best option is to use a Perl script or something similar...
>
>-----Original Message-----
>From: Steve Tinney [mailto:stinney@xxxxxxxxxxxxx]
>Sent: Tuesday, February 01, 2000 3:58 PM
>To: xsl-list@xxxxxxxxxxxxxxxx
>Subject: Re: multiple input files to one output file
>
>
>Linda van den Brink wrote:
>> Is it possible with XSLT to have lots of input files, and create one
>output
>> file listing specific data from each of the files?
>>
>> What are my options to achieve this?
>
>XSLT spec under document().  You will need to manage the actual
>integration of your list of documents into the XSL script, either
>manually, by use of some kind of XML control file, or with a Java
>extension function.
>
> Steve
>
>--
>----------------------------------------------------------------------
>Steve Tinney                                        Babylonian Section
>                                 *   University of Pennsylvania Museum
>stinney@xxxxxxxxxxxxx                          Phila, PA. 215-898-4047
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


James Garriss | The MITRE Corporation | jgarriss @ mitre.org




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.