dark_ixion Posted July 14, 2008 Share Posted July 14, 2008 Hi, I need to create newly transformed XML given input XML and XSLT. The problem is, all the examples I've seen require that inputs and outputs point to files, like the function xslt_process. The reason I don't want a file for input or output is that I will already have my XML in a string and just want to return a transformed XML doc to the user without the overhead of outputting the XML to a file, then tranforming it, loading the file and returning it to the user. So basically, I need something like this to work... $xml = '<myxml myattrib="monkey"><test>a test</test></myxml>'; $xslt = "can be a document or a string, I don't mind"; $outputxml = xmlTransform($xml, $xslt); // $outputxml is now a string which contains a transformed xml document Does anyone know how I could do this? Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/ Share on other sites More sharing options...
rhodesa Posted July 14, 2008 Share Posted July 14, 2008 Example 3 on the PHP Doc shows how: http://us3.php.net/manual/en/function.xslt-process.php Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589560 Share on other sites More sharing options...
dark_ixion Posted July 14, 2008 Author Share Posted July 14, 2008 Example 3 on the PHP Doc shows how: http://us3.php.net/manual/en/function.xslt-process.php Unfortunately I am using PHP 5, so I can't use that library. Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589580 Share on other sites More sharing options...
rhodesa Posted July 14, 2008 Share Posted July 14, 2008 It's part of PHP5, just not enabled by default: http://us3.php.net/manual/en/xslt.installation.php Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589597 Share on other sites More sharing options...
dark_ixion Posted July 14, 2008 Author Share Posted July 14, 2008 It's part of PHP5, just not enabled by default: http://us3.php.net/manual/en/xslt.installation.php Oh, I see. Unfortunately it looks like it's not enabled on my copy, which I can't change because it's part of a production environment at work. Are there alternatives which I could use, such as a php library I can add as part of my project? Looks like a lot of libraries have been disabled. Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589616 Share on other sites More sharing options...
rhodesa Posted July 14, 2008 Share Posted July 14, 2008 ....not that i'm aware of Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589621 Share on other sites More sharing options...
mikeschroeder Posted July 14, 2008 Share Posted July 14, 2008 What about the php5 XSL library? http://us2.php.net/xsl This extension should be included by default, just not enabled. Also if you possibly have the JavaBridge for php installed, I've read some comments in the manual in regards to using it to call the SAXON library. http://us.php.net/manual/en/book.xsl.php#78436 Although I can't speak to the performance gain/loss of this approach. Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589634 Share on other sites More sharing options...
dark_ixion Posted July 14, 2008 Author Share Posted July 14, 2008 What about the php5 XSL library? http://us2.php.net/xsl This extension should be included by default, just not enabled. Also if you possibly have the JavaBridge for php installed, I've read some comments in the manual in regards to using it to call the SAXON library. http://us.php.net/manual/en/book.xsl.php#78436 Although I can't speak to the performance gain/loss of this approach. I've just checked and xsl is marked as "without", so I can't use that either Link to comment https://forums.phpfreaks.com/topic/114642-creating-transformed-xml-using-xslt/#findComment-589645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.