I ran your code without any problems. Your stack trace shows a Class Cast exception inside xalan.jar. Could be you have a bad jar, a bad system configuration or properties file somewhere, or its always possible you are missing some necessary jars.
The following jars may be necessary in addition to xalan.jar:
xerces.jar xml-apis.jar xerces.jar saxpath.jar
Joined: Jun 16, 2004
I had problem with xalan.jar. After fixing it everything was ok. Thank you very much.