Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to use XSLT 2.0 with PHP?

Tags:

php

xml

xslt

This is my second question on the site, like always, I've spent several hours reading a lot of related questions, the 2 most relevant are:

  • Will XPath 2.0 and/or XSLT 2.0 be implemented in PHP? Which explains a solution using PHP/Java Bridge and Saxon.

And

  • Upgrade PHP XSLT processor to XSLT 2.0 Which explains a solution using XML_XSLT2Processor, installing it with PEAR and PHP.

I focused mainly on the second option since php already have a XSLTProcessor library, but sadly it only supports XSLT 1.0 and I'm looking 2.0 support, so it seemed to be the right option, but after installing PEAR and trying to install XML_XSLT2Processor, and reading many articles(1, 2, 3, the ones I currently have open about the topic) and AltovaXML gone commercial, and PEAR being so buggy, I decided to go with the first option.

But I don't really know Java, yet I'm gonna give it a try, but before starting with this I decided to ask first (plus the posts are a little outdated).

Isn't there any other better way to manage XSLT 2.0 with PHP?

like image 212
Lauro182 Avatar asked Dec 04 '13 01:12

Lauro182


1 Answers

The question is timely because last week we launched Saxon/C, a port of Saxon compiled to Intel machine code with APIs for C, C++, and PHP. It's early days yet (an Alpha 0.1 release), but if you don't mind being at the bleeding edge, you might give it a try. And of course we welcome your feedback. Details at http://www.saxonica.com/saxon-c/index.xml

like image 94
Michael Kay Avatar answered Sep 21 '22 02:09

Michael Kay