[XSL] : how to get the value of a variable defined in a program ?

Discussion in 'XML' started by MC, Mar 22, 2005.

  1. MC

    MC Guest

    HI to all,

    First excuse me but i'm xsl beginner.

    I'm using XSL to transform an xml file into another. I'm using a Java
    program for the transformation (TraX API).

    I would like to recover in the xsl stylesheet the value of a variable
    defined in my Java program. Is it possible ?

    Thanks a lot for yours answers

    Marie
     
    MC, Mar 22, 2005
    #1
    1. Advertising

  2. Re: [XSL] : how to get the value of a variable defined in a program?

    MC wrote:

    > I'm using XSL to transform an xml file into another. I'm using a Java
    > program for the transformation (TraX API).
    >
    > I would like to recover in the xsl stylesheet the value of a variable
    > defined in my Java program. Is it possible ?


    You can pass in parameters to the processor before running a
    transformation, see
    <http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/Transformer.html#setParameter(java.lang.String,%20java.lang.Object)>
    That parameter needs to be declared in the XSLT stylesheet e.g.
    <xsl:param name="paramName" />
    and then the stylesheet elsewhere uses
    $paramName
    in expressions.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 22, 2005
    #2
    1. Advertising

  3. MC

    MC Guest

    Re: [XSL] : how to get the value of a variable defined in a program?

    Thanks a lot. It works very well ;-)

    Marie
    Martin Honnen a écrit :

    >
    >
    > MC wrote:
    >
    >> I'm using XSL to transform an xml file into another. I'm using a Java
    >> program for the transformation (TraX API).
    >>
    >> I would like to recover in the xsl stylesheet the value of a variable
    >> defined in my Java program. Is it possible ?

    >
    >
    > You can pass in parameters to the processor before running a
    > transformation, see
    > <http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/Transformer.html#setParameter(java.lang.String,%20java.lang.Object)>
    >
    > That parameter needs to be declared in the XSLT stylesheet e.g.
    > <xsl:param name="paramName" />
    > and then the stylesheet elsewhere uses
    > $paramName
    > in expressions.
    >
    >
     
    MC, Mar 22, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karsten Weinert
    Replies:
    3
    Views:
    1,016
    Karsten Weinert
    Jul 5, 2004
  2. MC
    Replies:
    1
    Views:
    7,270
    David Carlisle
    Mar 24, 2005
  3. Replies:
    1
    Views:
    3,617
    A. Bolmarcich
    May 27, 2005
  4. Replies:
    2
    Views:
    9,280
    Martin Honnen
    Sep 5, 2006
  5. Oodini
    Replies:
    1
    Views:
    1,779
    Keith Thompson
    Sep 27, 2005
Loading...

Share This Page