[xslt] Problem with extension element namespaces and xsl:include?



It appears that extension element recognition is done half on namespace
prefix and half on namespace URI.

xsltproc version:

------------------------------------------------------------
Using libxml 20630-SVN3659, libxslt 10124-SVN1490 and libexslt 813
xsltproc was compiled against libxml 20630, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20630
libexslt 813 was compiled against libxml 20630
------------------------------------------------------------

This came up in the context of using xsl:namespace-alias, but it happens
irrespective of whether or not you use xsl:namespace-alias.

The results of running three XSL files on themselves:

 - func.xsl:

------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:template match="/">
    <func:function xmlns:func="func"/>
  </xsl:template>

</xsl:stylesheet>
------------------------------------------------------------

xsltproc func.xsl func.xsl 
<?xml version="1.0"?>
<func:function xmlns:func="func"/>

 - import.xsl:

------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:func="http://exslt.org/functions";
  extension-element-prefixes="func"
  version="1.0">

  <xsl:import href="func.xsl"/>

</xsl:stylesheet>
------------------------------------------------------------

xsltproc import.xsl import.xsl
<?xml version="1.0"?>
<func:function xmlns:func="func"/>


 - include.xsl:

------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:func="http://exslt.org/functions";
  extension-element-prefixes="func"
  version="1.0">

  <xsl:include href="func.xsl"/>

</xsl:stylesheet>
------------------------------------------------------------

xsltproc include.xsl include.xsl
runtime error: file func.xsl line 6 element function
xsltApplySequenceConstructor: failed to find extension function
no result for include.xsl


It appears that the "func" prefix is triggering extension element
lookup though the current namespace URI for the "func" prefix has not
been registered as an extension function.

This appears to be incorrect on two counts.  The obvious is the
namespace difference.  The other is, from [1]:

   The designation of a namespace as an extension namespace is effective
   within the subtree of the stylesheet rooted at the element bearing
   the extension-element-prefixes or xsl:extension-element-prefixes
   attribute; a subtree rooted at an xsl:stylesheet element does not
   include any stylesheets imported or included by children of that
   xsl:stylesheet element.

So even if func.xsl had used the correct EXSLT namespace,
<func:function> should have not been recognised as an extension element
unless the namespace was declared as an extension namespace in func.xsl.

Regards,


Tony Graham                         Tony Graham MenteithConsulting com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2

[1] http://www.w3.org/TR/xslt#extension-element


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]