|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Variable assignment outside 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
|
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
|

Cart








