[xslt] Module initialization with built-in user-defined data elements "meta" and "initialize-module"



Hi,

In order to eliminate module initialization based on
namespaces defined via "extension-element-prefixes",
I'm thinking of adding a built-in user-data element "meta"
(in conjunction with the element "initialize-module")
to control Libxslt's module initialization.

Here's what I currently have in mind:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";  
  xmlns:my-test="urn:test:myTest">

  <!-- The new meda data element of Libxslt. -->
  <meta xmlns="http://xmlsoft.org/XSLT/";>
    <!--
      Initialize the module "urn:test:myTest" at compile-time.
      The attribute @scope can be one of:
      1) "global" - global storage of user-data for this module
      2) "stylesheet-level" - per stylesheet-level storage of
                              user-data for this module
      -->
    <initialize-module namespace="urn:test:myTest" scope="global"/>
  </meta>

  <xsl:template match="/">
    <!--
      If the extension function needs access to user-data of the
      module, then it could either initialize the module during
      execution, which should be avoided, since it will modify
      the stylesheet during transformation-time (leading to
      race conditions), or Libxslt's module initialization user-data
      element "meta" can be used to initialize the module at
      compile-time.
    -->      
    <foo bar="{my-test:my-ext-func()}" />
  </xsl:template>
  
</xsl:stylesheet>

Comments and further ideas are appreciated.

Issues:
1) Are the element names OK? intuitive enough?
2) Do we need to specify more information than the "namespace"
   and data-storage "scope"?
3) What about dynamic modules? Do we need something for them?

Regards,

Kasimier


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