Thank you John,
This is exactly what I was looking for.
Has anyone tried this out on XSLTC?
Greetings,
Nils Kaiser
John Gentilin schrieb:
Nils,
You can register a specific instance of an extension class, on a per
transformation basis,
using the transformer.setParameter() method. You still need to declare
the namespace
in the XSL declaration, then you need to declare the <xsl:param
name="myInstance"/>
as a global variable. Now you can call methods on the specific
instance with something like
<xsl:value-of select="myInterface:someMethod($myInstance, param1,
param2...)"/>
Xalan uses reflection to resolve method names on the fly so in theory
you can use the setParameter
to set myInstance to a different class but you may run into issues it
you are trying to cache/reuse
templates. I would make MyInstance be something more generic that
could class load a specific
class depending on the instance data...
BTW.. This info is for interpretive Xalan, this may behave differently
in compiled XSL...
Hope this helps
John G