Jak transformaci spouštět z Javy

STX podporuje rozhraní JAXP, čili STX procesor lze nastavit jako transformační nástroj v JAXP a následně místo XSLT stylů používat STX styly:

// use Joost as transformation engine
System.setProperty("javax.xml.transform.TransformerFactory",
                   "net.sf.joost.trax.TransformerFactoryImpl");

// the remaining code is known area
TransformerFactory tFactory = TransformerFactory.newInstance();
SAXTransformerFactory saxTFactory = (SAXTransformerFactory) tFactory;

// of course the transformation source must be different
TransformerHandler tHandler1 = 
    saxTFactory.newTransformerHandler(new StreamSource("trans.stx"));
...
myReader.setContentHandler(tHandler1);
myReader.setProperty("http://xml.org/sax/properties/lexical-handler", 
                     tHandler1);
tHandler1.setResult(new SAXResult(tHandler2));
...