Assuming I have a piece of code like:
Map mappingId = new HashMap();
mappingId.put("1", "1000");
transformer.setParameter("mappingId", mappingId);
transformer.transform(...);
and I have a simple XSLT that tries to get the key to this
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:map="xalan://java.util.Map"
extension-element-prefixes="map">
<xsl:param name="mappingId" />
<xsl:template match="/">
<xsl:variable name="id" select="map:get($mappingId, '1')" />
<MappedId><xsl:value-of select="id"/></MappedId>
</xsl:template>
</xsl:stylesheet>
I get the following error:
ERROR: 'could not find method java.util.Map.get ([ExpressionContext,] #STRING, #STRING) FATAL ERROR: "Could not compile stylesheet".
Can anyone help me find out how to access a java map in XSL?
V joe source
share