I'm using the Saxon XSLT processor in my PHP based content management system.  I've got everything running nicely using the PHP/Java bridge.  I've got some free time during the holidays so I'm trying to come up with ways of squeezing more performance out of my setup, and I've been thinking of how the data goes from a PHP to Java to be transformed and then back to PHP.  Basically it goes like this.

PHP has either a PHP DomDocument instance or a basic string with some XML.  Either way, I send an XML string over to the java side of things and create a StreamSource and do the saxon transform on that.

If my source document is a PHP DomDocument instance, I could recurse through the DOM in PHP and build a mirror DOM over on the java side through the bridge and then use a DomSource instead with the transformation.

My main concern is all the extra serialization/unserialization that occurs when we go from dom to string and back and forth, etc, so...

I guess the main question is whether or not the saxon transform is happier/faster if it gets a DOMSource instead of a StreamSource?  How about the other classes that Implemet Source?  Is another one a better starting point for the saxon transform process?

I'm assuming that if you pass it a stream it has to parse and turn it into a data structure, but I wanted to ask around to make sure. 

John McGowan