w3evolutions Posted November 18, 2009 Share Posted November 18, 2009 I am trying to use PHP's XSLTProcessor() to generate some html pages. All is working well until I found out that you can't include multiple xsl sheets as they get overwritten, like the example on php.net. Just for reference, as of this writing, this function does not support importing multiple stylesheets. The following will output only the stylesheet transformation of the second imported sheet: <?php # LOAD XML FILE $XML = new DOMDocument(); $XML->load( 'data.xml' ); # START XSLT $xslt = new XSLTProcessor(); # IMPORT STYLESHEET 1 $XSL = new DOMDocument(); $XSL->load( 'template1.xsl' ); $xslt->importStylesheet( $XSL ); #IMPORT STYLESHEET 2 $XSL = new DOMDocument(); $XSL->load( 'template2.xsl' ); $xslt->importStylesheet( $XSL ); #PRINT print $xslt->transformToXML( $XML ); ?> the problem is I have the xsl files tempalted as: Header Content Footer which are to be included in the site_contianer.xsl. I need to figure out a way to dynamically create an: <xsl:include .. /> when I tried a str_replace() the transformation failed. any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/182004-xsl-and-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.