Passing arguments to XSLT

Discussion in 'Java' started by ashuvashi, Nov 16, 2005.

  1. ashuvashi

    ashuvashi Guest

    Hi Friends,

    I m using XSLT. I would like to pass some value as arguments to that and
    that should be used in future usage.

    Please help me.

    Thanks in Advandce.
    Ashesh Vashi
     
    ashuvashi, Nov 16, 2005
    #1
    1. Advertisements

  2. ashuvashi wrote:

    Within the XSLT stylesheet declare global parameters e.g.
    <xsl:param name="arg1" />
    or if you want a defaut value e.g.
    <xsl:param name="arg1" select="'value 1'" />
    Then in your Java code you can use the setParameter method e.g.
    transformerInstance.setParameter(
    "arg1",
    "value 2"
    );
    to set the parameter before you do the transformation.

    Within the stylesheet code you can then use $arg1 to access the
    parameter value.
     
    Martin Honnen, Nov 16, 2005
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.