Below is the PHP routine I use for this in my JavaScript AJAX library.
Obviously your host server must support PHP -and- have the XSL extension
loaded, but this should be fairly standard these days.
Note this also works for RSS feed XML/XSL translations.
I'm sure you can tie this routine into your own JavaScript and AJAX calls
but my free library has working examples to download if needed (Home above).