cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_Boag/CAM/Lo...@lotus.com>
Subject Re: Passing parameters to XSL processor
Date Fri, 17 Dec 1999 15:56:19 GMT


> Scott, what's the best/fastest way to pass Xalan parameters on the fly?

Basically:

processor.setStylesheetParam("param1", processor.createXString(args[0]));

Or there are variants:

  /**
   * Push a top-level stylesheet parameter.  This value can
   * be evaluated via xsl:param-variable.
   * @param key The name of the param.
   * @param value An XObject that will be used.
   */
  public void setStylesheetParam(String key, XObject value);

  /**
   * Push a top-level stylesheet parameter.  This value can
   * be evaluated via xsl:param-variable.  Note that the value
   * passed is an expression, and not a string.  This means that
   * setStylesheetParam("foo", "hello"); will look for the
   * element "hello".  If you want to pass a string, you'll
   * need to put quotes around it:
   * setStylesheetParam("foo", "'hello'"); will look for the
   * @param key The name of the param.
   * @param expression An expression that will be evaluated.
   */
  public void setStylesheetParam(String key, String expression);

The createXFoo variants in the XSLTProcessor interface are there to hide
you from having to do a new XString("foo") or the like.

There is a simple example in the params directory in the samples directory.

-scott






Mime
View raw message