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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MC

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

    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
  • Martin Honnen

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



    MC wrote:
    [color=blue]
    > 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 ?[/color]

    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.htm l#setParameter( java.lang.Strin g,%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

    Comment

    • MC

      #3
      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 :
      [color=blue]
      >
      >
      > MC wrote:
      >[color=green]
      >> 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 ?[/color]
      >
      >
      > 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.htm l#setParameter( java.lang.Strin g,%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.
      >
      >[/color]

      Comment

      Working...