Now, I'm wondering if I could generate the XSLT file dynamically by replacing
saxon:evaluate($xpath_parameter)
by
<?php
echo $xpath_generated_by_php;
?>

Yes, you could certainly do that.

Would you recommend that solution?

In most situations I would advise against it, because you then need to compile the complete stylesheet each time you run it. But in your architecture you are incurring that cost anyway, so you might as well.

If so: Is it possible to give Saxon an XSLT directly as a string instead of a path pointing to a file?

It's possible, but not when running from the command line, which is what you are currently doing. I'll ask O'Neil to comment on what is possible in the latest PHP Saxon/C API.

Michael Kay
Saxonica



I think, I can't use Saxon/C because it is the HE version and I need a saxon extension for dynamically evaluate the XPath expression created by the PHP script. Don't I?

Yes we expect to issue Saxon-PE/C and Saxon-EE/C at some stage in the future, but they haven't been made available yet, mainly because we need to devise the best way to issue and configure license keys.