[xslt] Extension module initialization is called for every imported stylesheet



Hi,

Extension module initialization functions will be called
once for every imported stylesheet (plus the main stylesheet).
The initialization function is the "xsltStyleExtInitFunction"
argument of the xsltRegisterExtModuleFull() function.
Is this the intended design? I.e., is the initialization
expected to be called for *every* imported stylehsheet and not
only once for a whole stylesheet compilation episode?

The init functions are fired by the following callstack:
... -->
 xsltParseStylesheetExtPrefix() -->
  xsltRegisterExtPrefix() -->
   xsltStyleGetExtData():
     
... in the example below, xsltStyleGetExtData() will call
xsltExtStyleInitTest() (this is an example initialization
function defined in extensions.c).
xsltExtStyleInitTest() will be called twice in this example.

Example:

Main stylesheet - "ext-test.xsl"

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:libxslt="http://xmlsoft.org/XSLT/";
  extension-element-prefixes="libxslt">

  <xsl:import href="ext-test-imp.xsl"/>
  <xsl:template match="/">
    <libxslt:test/>
  </xsl:template>
  
</xsl:stylesheet>

Imported stylesheet - "ext-text-imp.xsl"

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:libxslt="http://xmlsoft.org/XSLT/";
  extension-element-prefixes="libxslt">

  <xsl:template name="foo">
    <libxslt:test/>
  </xsl:template>

</xsl:stylesheet>

Regards,

Kasimier


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