Using xsl:import inside XsltDb

XsltDb allows you to include child XSLT tenplates in module configuration using standard xsl:import tag. But you also can import another configuration that defines some basic elements.


<xsl:import href="mdo:import(buttons)" />

<xsl:template match="/">
  <xsl:call-template name="small-button" />
</xsl:template>
mdo:import(buttons) loads a configuration with alias 'buttons' Inside configuration 'buttons' we can define tamplates that can be reused in other modules.

Another way is to create an .xslt file at ~/Portals/_default and import it as follows:


<xsl:import href="mdo:somefile.xslt" />

You also can create an <mdo:importable> section and use mdo:import-local operator to import such block as external XSL:


<xsl:import href="mdo:import-local(local-template)" />
<xsl:template match="/">
  <xsl:call-template name="test" />
</xsl:template>

<mdo:importable name="local-template">
  <xsl:template name="test">
    {{'Works'}}
  </xsl:template>
</mdo:importable>
  • mdo:import-local imports a template from the same configuration.

Last edited Jan 17, 2011 at 6:54 AM by findy, version 2

Comments

trapias Jan 17, 2011 at 8:38 AM 
Thanks :-)