Hi
As far as passing data into the transformation, see below. If this is the
right overall solution to your path problem, I don't know.

Assume you have a transformer instance,
      Transformer transformer;

Call the setParams method before executing the transformation:

      transformer.setParameter("myVar","myValue");

Inside the XSLT file, "declare" the param using the same name. Here I also
assign a default value, the empty string:

      <xsl:param name="myVar"  select="''"/>

Now refer to the param using XSLT variable syntax:

      <xsl:value-of select="$myVar"/>

This is standard Java JAXP stuff. Any JAXP compliant transformer will
support this.
Refer  to the JAXP spec/API docs for more details.

-chris



                                                                           
             Esther Parrilla                                               
             Endrino                                                       
             <esther.parrilla@                                          To 
             deimos-space.com>         [EMAIL PROTECTED]        
                                                                        cc 
             09/19/2003 01:54                                              
             PM                                                    Subject 
                                       pass an argument to XSL file?       
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hello all,

I am re-using the Xalan simpletransform.java class to transform and XML
into HTML using an XSL, I would like to know if is possible to pass an
argument to the XSL template using any transformation method of Xalan...
now I am using:
Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
transformer.transform(new StreamSource(xml), new StreamResult(new
FileOutputStream(html)));
Is possible to pass a value to any transformation function and read that
input value in the XSL?
I need this because in the XSL I am loading an external XML file using
the document() function but the full path to that external file is not
always the same and I do not know how I could make this path a variable
....

thanks in advance,

e*

--

~ Code matters more than comercials ~

--




Reply via email to