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

RE: Variable assignment outside XSL

Subject: RE: Variable assignment outside XSL
From: "Roger Glover" <glover_roger@xxxxxxxxx>
Date: Mon, 3 Feb 2003 12:06:04 -0600
assignment in xsl
Delaney Robin wrote:
> Is it possible to assign variables outside of XSL which can be accessed
from
> within (during transformation).

Not using system variables, like in a shell script or .bat file.

... skipping to the bottom ...
> Or is there
> any suggested method to pass info into XSL ?

Yes, you are looking for parameter semantics (<xsl:param>), but the usage is
context-specific.

... skipping back to where we were ...
> I need to create extra elements in an XML
> file  to hold values like date-time, username, filename(can I get this
from
> document()?), servername etc...........

Use this syntax inside the XSLT source:

    <xsl:transform ....>
        <xsl:param name="date-time"/>
        <xsl:param name="username"/>
        <xsl:param name="filename"/>
        <xsl:param name="servername"/>

        .... rest of transform goes here ....

    </xsl:transform>

Outside the transform syntax for passing in parameters varies according to
vendor and execution context.  For example, in Xalan-J, using the java
executable class "Process", you would write a command line something like
this (pardon the long line overflow):

    java org.apache.xalan.xslt.Process -IN file.xml -XSL trans.xsl -PARAM
date-time "2003-02-03T11:35" -PARAM username roger -PARAM filename
file.xml -PARAM servername hikimi

On the other hand, if you were running the transformation from within a java
program, adding the parameters would look something like this:

    javax.xml.transform.Transformer transformer;

    ... other code to instantiate and configure "transformer" omitted ...

    transformer.setParameter("date-time", "2003-02-03T11:35");
    transformer.setParameter("username", "roger");
    transformer.setParameter("filename", "file.xml");
    transformer.setParameter("servername", "hikimi");


I hope this helps!

-- Roger Glover
   glover_roger@xxxxxxxxx



 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.