note 63666 deleted from ref.xslt by sobak
| From: | sobak@php.net | Date: | Tue, 22 Nov 2016 03:38:24 +0000 |
| Subject: | note 63666 deleted from ref.xslt by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207385@lists.php.net to get a copy of this message | ||
Note Submitter: bat at flurf dot net
----
maurits says that libxslt should be preferred over Sablotron, but I disagree. libxslt only
implements a fraction of the capabilities of Sablotron; in particular, this doesn't work in
libxslt:
<xsl:variable name="x">
<a>One</a>
<a>Two</a>
<a>Three</a>
</xsl:variable>
<xsl:for-each select="$x/a">
<xsl:value-of select="."/>
</xsl:for-each>
In Sablotron, which implements XSLT 1.1, this works fine. In libxslt's version, XSLT 1.0, a
variable is a "result tree fragment", not a nodeset, and you are arbitrarily not allowed
to do as much with it.
Further, Sablotron allows callbacks via the document() function (see information on
xslt_set_scheme_handler()) and appears to give /slightly/ more informative error messages -- they
identify the line number in the XSLT file at least.
In general, I can't recommend libxslt, which appears very underpowered. Sablotron is
considerably more impressive.