You can use Saxon via the JAXP API. All you need to do is
to ensure that Saxon gets invoked as the XSLT processor. There are various ways
you can achieve this:
(a) in theory, it's enough to have saxon8.jar on the
classpath. However, this is a bit fragile, and also causes a search of the
classpath, which can be slow.
(b) you can set the system property
javax.xml.transform.TransformerFactory to the string
"net.sf.saxon.TransformerFactory" (or for Saxon-SA,
"com.saxonica.SchemaAwareTransformerFactory"). You can do this either from the
command line using the -D switch (this is a java option, so it goes before the
class name: "java
net.sf.saxon.Transform ..."), or you can do it by calling System.setProperty()
before you call TransformerFactory.newInstance().
(c) You can instantiate Saxon directly by calling "new
net.sf.saxon.TransformerFactory()" in place of
"TransformerFactory.newInstance()". This is the fastest and most reliable
method; its only disadvantage is that your code then has a compile-time
reference to Saxon.
Another tip: include
in your stylesheet so that you can see which XSLT processor
was actually used.
i am very new to saxon and i am very familiar with JAXP.
but being a beginner in saxon i am unbale to know
how to apply xslt to xml
using saxon-java api.not using command line type.i exhaustly searched gogole
result. any help in this regard is great