Calling java methods from XSLT

I am working in XSLT and java. I am trying to call a java method from XSLT. But am getting error. Can any body tell me how to call a java method from xslt in XSLT2.0?
Thanks in advance

With Regards

If you are using Saxon 8, Michael Kay’s book “XSLT 2.0 Programmer’s Reference” contains a section on writing java extension functions.