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

AW: Supplying input file name as parameter

Subject: AW: Supplying input file name as parameter
From: "Fries, Markus, fiscus GmbH, Bonn" <M.Fries@xxxxxxxxxxx>
Date: Thu, 23 May 2002 12:55:50 +0200
xsl input file name
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@xxxxxxxxxxx [mailto:Mukul.Mudgal@xxxxxxxxxxx]
Gesendet: Donnerstag, 23. Mai 2002 11:23
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff:  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


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.