I’m trying to use the following code
# LOAD XML FILE
$XML = new DOMDocument();
$XML->loadXML( $exporteddatatransformed );
# START XSLT
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load( 'xsl/'.$xsltemplatefileid.'.xsl', LIBXML_NOCDATA);
$xslt->importStylesheet( $XSL ); <-- LINE 549
#PRINT
print $xslt->transformToXML( $XML );
But it generates the following error.
Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error: file /home/…./xsl/1234567890.xsl line 2 element stylesheet in /home/…../myfile.php on line 549
The XSL sheet looks like this:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>
I’ve currently trimmed it down to this “nothing” in order to diagnose where the problem occurs, but it still remains in this “basic” XSL version!
It seems to load fine if you replace the xsl:stylesheet line with this one :
Which means having this xsl file :
Instead of yours.
Does it work when you try to transform you file ?
Note : I’m not using XSL quite often, so not sure why what you proposed didn’t work ; but the “http://www.w3.org/1999/XSL/Transform” is used both on [wikipedia’s article about XSL Transformations][1], and in the [example .xsl file][2] used in the PHP manual…
So, I’m guessing this should help solve your problem, even if I don’t really know "why" ^^