ZPT-Sharp plugin architecture

ZPT-Sharp has two extension points which are driven by a plugin architecture.

Document providers facilitate the rendering of specific underlying document implementations, such as XML, HTML or others.

TALES expression evaluators provide logic for evaluating the differing types of TALES expressions.

These plugins are provided in separate libraries to the core ZPT logic. When deploying a ZPT-Sharp based application, you need only distribute the plugins which are required & relevant.

Installing plugins

ZPT-Sharp is not very useful at all if no plugins are installed. It will be unable to render any documents without at least one document provider, and it will be unable to understand any TALES expressions without at least one expression evaluator.

Installation via NuGet

When using the ZPT-Sharp NuGet packages, plugin installation is greatly simplified. To install a plugin, just install the appropriate package. The copying of the plugin binaries to appropriate locations, as well as the changes to your application configuration file are taken care of automatically.

Note that to have configuration changes performed automatically by NuGet, your application configuration file must exist when the packages are installed and must be named either app.config or web.config.

Manual installation

The manual installation procedure for plugins is as follows:

  • Copy the desired plugin libraries into the your application's 'private bin directory'. This is typically the same directory where the CSF.Zpt.dll file is installed.
  • Add content to the appropriate configuration file:
    • Indicate the assembly name of the plugin assemblies which are to be loaded
    • Indicate the type names of the default HTML and XML document providers
    • Indicate the type name of the default TALES expression evaluator

The assembly name of a plugin assembly is the equivalent of Assembly.FullName. You might be able to use just the shortened name though, this is typically the same as the assembly filename, without the .dll suffix.

The default document providers

Up to two document provider plugins may be nominated as the default providers for HTML and XML documents. The need for default document providers is particularly important when using the CLI page renderer application or when using the MVC view engine.

When using ZPT-Sharp as an API, whilst you may use the default providers, you may choose to bypass them by specifying a System.Type of document provider explicitly in your code.

The default expression evaluator

One expression evaluator plugin should be nominated as the default evaluator. This evaluator is then used for all TALES expressions which are not qualified with an expression prefix. This is important in all use-cases, unless you wish to prefix every expression in your ZPT documents.

In order to comply with the TALES specification, the evaluator CSF.Zpt.ExpressionEvaluators.PathExpressions.PathExpressionEvaluator should be set as the default.