It also has a limited number of built-in functions. So as a design issue, one has to consider what types of transformations are natural for XSLT and what transformations require a traditional programming language. There is an alternative to his approach and that is to use XSLT extensions. Extension elements and functions, allow you to mix XSLT with a programming language like Java or a scripting language like JavaScript. You now have a mixed model, which allows you to use both XSLT and the flexibility of a conventional programming language under one umbrella.
Extensions come in two flavors.
Extension elements are valid XML elements that perform specific actions. The element looks like XML making it easy to use for XSLT developers, but its underlying implementation can be in Java or other languages. The Redirect extension is an example that ships with Xalan. Using these extension elements you are able to redirect portions of your transformation output to different files. The first is org.apache.xalan.xslt.XSLProcessorContext, which includes access to the XSL processor, the current node, the source tree and the stylesheet tree.