You seem to have got into a muddle by naming your TransformerFactory hobbiesTransformer, a name which you previously used for your Transformer.
 
You should only need to change one line:
 
TransformerFactory stateFactory = TransformerFactory.newInstance();
 
with
 
TransformerFactory stateFactory = new net.sf.saxon.TransformerFactoryImpl();
 
Michael Kay
http://www.saxonica.com/


From: Jack Bush [mailto:netbeansfan@yahoo.com.au]
Sent: 18 February 2009 11:47
To: saxon-help@lists.sourceforge.net
Subject: [saxon] XSLT 2.0 Saxon 91 Instantiation

Hi All,

 

I came across the following minor stumbling block when trying to instantiate Saxon directly as opposed to searching through CLASSPATH:

 

( i ) Replaced import javax.xml.transform.* with net.sf.saxon.TransformerFactoryImpl.

( ii ) Replaced TransformerFactory stateFactory = TransformerFactory.newInstance() with

       net.sf.saxon.TransformerFactoryImpl hobbiesTransformer = new net.sf.saxon.TransformerFactoryImpl().

       FileInputStream hobbiesStyleSheetIS = new FileInputStream(hobbiesStyleSheet);

       BufferedInputStream hobbiesStyleSheetBIS = new BufferedInputStream(hobbiesStyleSheetIS);

( iii ) Replaced Transformer hobbiesTransformer = hobbiesFactory.newTransformer(new StreamSource(hobbiesStyleSheetBIS)) with

       hobbiesTransformer.newTransformer(new StreamSource(hobbiesStyleSheetBIS)).

 

       JDOMSource hobbiesSource = new JDOMSource(hobbiesOriginaljdomDocument);

       JDOMResult hobbiesResult = new JDOMResult();

 

       System.err.println(hobbiesTransformer.getClass());

( iv ) Would like to replace hobbiesTransformer.transform(hobbiesSource, hobbiesResult) with

stateTransformer.? but couldn't find a match.

 

In other word, I couldn't find an equivalent statement in Saxon91 to do the transformation in step ( iv ) to swap out the default Java Xalan code.

 

Thanks a lot for your help,

Jack




Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more.