Subject:Template Rule Problem Author:Michael Basile Date:15 Sep 2004 09:30 AM
Ivan,
This behavior doesn't follow the XSL 1.0 spec. (I don't know about 2.0). It
does fail under the MSXML processors (3,4, and .NET) and Saxon 6, but doesn't
under the Saxon 7 and Xalan-J processors (which I think is also a problem).
The following should produce an error (according to Sec. 5.3 of XSL 1.0 spec):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="location" select="'local'"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="node[@loc=$location]">
this is an error, I think
</xsl:template>
</xsl:stylesheet>
If it is 2.0 behavior, then the problem is in the stylesheet version attribute.
Subject:Template Rule Problem Author:Ivan Pedruzzi Date:19 Sep 2004 05:36 AM
Hi Michael,
I assume you meant node()[@loc=$location]
Built-in and XalanJ do not enforce this particular rule (personally, I find it handy).
For Saxon 7 I believe is a side effect of XSLT 2 initial support.
The processor doesn't fire the error but the template doesn't macth.
Saxon 8.x is a much better platform to develop XSLT 2 and XQuery.