XsltDb Code Reuse

XsltDb provides a number of methods that allows you to include or call one configuration in another.
  • <xsl:import /> tag. Includes external XSL with templates that can be used within current
  • mdo:xsltdb ( alias )
  • mdo:transform ( xml, xslt )

mdo:xsltdb ( alias [, xml] )

Loads configuration by alias and executes it. optionally you can specify an XML that will be use as transformation main XML. by default it uses <root/>.

mdo:transform ( xml, xslt )

If you have an xslt in form of string you can apply it to an XML using mdo:transform.

Choosing right method

  • Using xsl:import is preferred when you have a limited static set of templates. xsl:import is loaded and compiled only once at the moment the calling configuration is processed. So it is much much faster. Imported templates can be used efficiently in loops.
  • Using mdo:transform and mdo:xsltdb is preeferred when you have to choose right transformation from hundreds possible. In this case you often can't determine complete set of tranform at development stage or you have hundreds of it so inclusion all of them is quite inefficient.

Last edited Dec 12, 2010 at 12:04 PM by findy, version 1

Comments

No comments yet.