Right now, PHP + libxslt runs XSLT1.0, the basic 1999 flavour of XSLT which includes all the basic <xsl:for-each> and <xsl:template> and <xsl:value-of> bits, along with XPATH1.0 which allows methods like "contains(str,str)".
Michael Kay recommended XSLT2 to the W3C in January this year (
http://www.w3.org/TR/xslt20/), with a fleet of powerful new features, like <xsl:analyze-string> and <xsl:matching-substring>. XSLT2 uses XPATH2 (
http://www.w3.org/TR/xpath20/), another upgrade including new features -- for instance, expressions which match strings captured by regex, "regex-group($group-number)". XSLT2 also has some awesome new date formatting options.
There is only one known XSLT2 processor called saxon (
http://saxon.sourceforge.net/), built by Michael Kay, which was released for the Java and .NET platforms.
Other XSLT processors, including Sablotron, Xalan and MSXML, have not yet adopted XSLT2.
I think Mr. Kay will forgive me quoting from our personal correspondence on this subject: "implementation [for PHP] does not exist because no-one has written one". He continues, "The usual workaround I recommend is to implement XSLT 2.0 transformation as a (Java-based or .NET-based) REST web service, and for the PHP application to submit transformation requests to that web service by means of HTTP requests. An alternative is to use a PHP-Java bridge"
Partager