Good Afternoon.
Here is a short tutorial on "how to extends Xalan XSTL processor features ?"
Actually, I wanted to obtain some new features about string modification.
I've tried lots of alternative mecanisms. Unfortunately, lots of them are not really efficient (Javascript, specific templates...)
However, the following one is a easy way to add feature, by coding functions in Java.
You have just to create a new Java Object which contains one (or more) static function(s).
For instance :
com.codesquale.xslt.StringExtension
In XSLT file, you must add a new namespace , in addition of this one :
xmlns:str="xalan://com.codesquale.xslt.StringExtension"
The new one is like
xmlns:str="xalan://com.codesquale.xslt.StringExtension"where str is the prefix of the namespace.
In the extension-element-prefixes, you must add the new prefix, too.
The last step is to add a new component in xslt stylesheet :
<xalan:component prefix="str" elements="replace">
<xalan:script lang="javaclass" src="xalan://com.codesquale.xslt.StringExtension" />
</xalan:component>
As you can see, all the functions must be declared (here replace)
In attached files, you can find an example xslt file and the javaclass for the extension.
Damien Cuvillier
Ingénieur étude et architecture
Ajilon
Tél : 06.73.35.21.66
Email :
damien.c...@ajilon.fr
Please consider your environmental responsibility before printing this e-mail.