Trenton D. Adams schrieb am 12.11.2009 um 16:19:35 (-0700): > I didn't send an attachment, I sent a link. Do links get removed too?
I must have been very tired when looking for the attachment. > As for it being 10k, the important part is that it does not work with > a processing instruction of "<?xml-stylesheet...?>", but does work > without one (i.e. specifying one in the java code). It's not the > XML/XSLT that is important to look at, but the Java code, which is > very small, and easy to follow, especially considering it's a simple > JUnit test. Maybe, but it is way more complex than it should have to be. Anyway, I get two failures because of: junit.framework.AssertionFailedError caused by javax.xml.transform.TransformerException caused by java.net.UnknownHostException And it is little wonder as your stylesheet PI misses a valid URI: <?xml-stylesheet type="text/xsl" href="file://${basedir}/target/test-classes/transcript.xsl"?> Corrected this to: http://localhost/g/xml-util/target/test-classes/transcript.xsl Now: junit.framework.AssertionFailedError caused by java.io.IOException: Stream closed Okay, the error is in reading the PI from the StreamSource by calling getAssociatedStylesheet(), and then trying to read again from the same StreamSource by calling transform(). Streams are to be used once only. Fixing this in your program is cumbersome, because you have one big method with parameters of type Object which you then cast to whatever you need based on what instanceof tells you. public static String xslTransformation( final Object xml, final Object xsl, final Map parameters ) What's wrong with using polymorphism instead? It's vastly superior. Also, please consider providing simple test cases. You'd have discovered this error yourself if you had taken the time to build a simple test case without so many complicating ingredients. It bears repeating here that simplifying is a basic problem solving technique. Best, -- Michael Ludwig