This above won't do that in particular; that's a manual iteration of the dom itself.
Although, if you want to inject the XSLT directly, I believe that can be done as well. Let me track that down.
Mkay, here we go. You simply inject the processing instruction:
$dom = new DOMDocument('1.0', 'utf-8');
$xslt = $dom->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="thatxslt.xsl"');
Yeah. I knew there was a way to do this.
I haven't tested it or anything, but that should insert the instruction prior to outputting the dom. I don't see a reason why it wouldn't work remotely as well (since it's handled on this server end and not on the origin server).