This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
AW: Supplying input file name as parameter
- From: "Fries, Markus, fiscus GmbH, Bonn" <M dot Fries at fiscus dot info>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 23 May 2002 12:55:50 +0200
- Subject: AW: [xsl] Supplying input file name as parameter
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
If you need one stylesheet with different inputs but only one at a time, you
do depending on your stylesheet processor s.th. like
xalan -XSL <stylesheet> -IN <inputfile> -OUT <outputfile>
If you do need more than one input file in a single transformation you have
different
options. You read from
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="inputfile"/>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:value-of select="item1"/>
<xsl:value-of select="document(item1/@name)/item"/>
<xsl:value-of select="document($inputfile)/item"/>
</xsl:template>
</xsl:stylesheet>
Now
xalan -XSL <stylesheet> -IN <inputfile> -OUT <outputfile> -PARAM inputfile
input.xml
[input.xml]
<item1 name="referenced.txt">
Item 1 Text
</item1>
[referenced.txt]
<?xml version="1.0" encoding="utf-8"?>
<item>
Referenced Text
</item>
will result in
[output.xml]
Item 1 Text
Referenced Text
Referenced Text
So you can read from a file with a fixed name the list of inputs. Or you
pass it with the parameters.
What does not work is using document({$inputfile}) as those are attribute
value templates.
Maybe you need some more basic reading?
Cheers
Markus
-----Ursprüngliche Nachricht-----
Von: Mukul.Mudgal@etindia.com [mailto:Mukul.Mudgal@etindia.com]
Gesendet: Donnerstag, 23. Mai 2002 11:23
An: xsl-list@lists.mulberrytech.com
Betreff: [xsl] Supplying input file name as parameter
Hi all
How can we supply a input (Source)file name as parameter instead of using
document() function in XSL file
I need to make a XSL file so generic so that it could be worked upon a
number of input files.So I need to supply file name as a parameter instead
of using document() function.
thanks
Mukul
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list