[xsl] Xalan-J: Setting Objects as Parameters in XSL

Subject: [xsl] Xalan-J: Setting Objects as Parameters in XSL
From: Seth Milder <mrseth@xxxxxxxxxxxxxxx>
Date: Mon, 20 Oct 2003 19:23:30 -0400
Hi List,

I am trying to use the Transformer.setParameter method with a
java.util.HashMap, but the transform tries to use a String type. If I
specify a default in XSL like:

<xsl:param name="parameterMap" select="java:java.util.HashMap.new />

I then just get an empty HashMap. Anyone know how to make this work?
Here's the Java code:

 HashMap propertyMap = new HashMap();
 propertyMap.put("membership", "0000000");
/* more stuff */
 transformer.setParameter("propertyMap", propertyMap);
 transformer.transform(source, result);

Then in the XSL:


  <xsl:param name="parameterMap" select="java:java.util.HashMap.new" />
  <xsl:output method="html" />
  <!-- More stuff -->
   <xsl:variable name="foo" value="membership" />
   <xsl:value-of select="java:get($parameterMap, $foo)"/>

Thanks a lot for any help!

Seth Milder
Department of Physics and Astronomy
MS 3f3
George Mason University
Fairfax, VA
Questions are never indiscreet, answers sometimes are. -- Oscar Wilde

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread