Description

HTML_Template_PXT is a pluggable XML template package

PXT differs from other templating systems by not defining the template syntax. PXT defines just a processing model for compiling templates, deferring the template syntax proper to PXT plugins. The result is a plugin system that allows defining of the template syntax.

The PXT execution model is as follows:
- The input document is first parsed and transformed into a DOMDocument. This implies that the input must be XML. The output may be XML or not, dependending on the plugins
- For each node in the input document, matching plugins get called, providing an opportunity to change the template DOM. This is repeated until no plugins affect the DOM.
- Each plugin is queried for code to be placed before content-producing code (typically, require_once declarations)
- For each node in the input document, top-down, matching plugins get called to produce PHP code for:
a) placing before the node content. Defaults to an empty string
b) placing instead of the node content. Defaults to the result of top-down processing the node content template subdocument.
c) placing after the node content. Defaults to an empty string.

In the PXT execution model, plugins are matched to nodes. Matching is based on XML namespaced node names and attributes. A plugin can match:
- All nodes
- All nodes of a type (processing-instructions, document-type-declarations, xml-declarations, nodes, attributes and text nodes)
- All nodes of a namespace
- All nodes with a given local name
- Any boolean combination of the above

Note that matching is delegated on matching classes, and each plugin is responsible for providing its matching method. This means that it is relatively easy to provide other types of matchers, as long as your plugin's HTML_Template_PXT_Plugin::matches follows HTML_Template_PXT_Matcher.

Download

Download at http://pear.sergiocarvalho.com/repository/HTML_Template_PXT-1.0.0.tgz
Documentation at http://pear.sergiocarvalho.com/docs/HTML_Template_PXT-1.0.0/
Browse source code at http://pear.sergiocarvalho.com/browse/HTML_Template_PXT-1.0.0
Install with: pear install sergiosgc/HTML_Template_PXT