Creating a Transformer

PreviousNext

Once you have an executable stylesheet, you need to create an XM_XSLT_TRANSFORMER from it. This is accomplished by calling new_transformer on the XM_XSLT_STYLESHEET_COMPILER.

The XM_XSLT_STYLESHEET_COMPILER is supposed to be serially reusable. That is, once you have executed one transform with the transformer you obtained from it, you can create another transformer from it. You do not have to re-compile the stylesheet.

However, you should not attempt to run two transformations at once (not even if they involve different stylesheets).

If you reuse a transformer, then before calling transform a second time, you may wish to call clear_document_pool. This clears all document nodes from memory, and destroys the mapping of URIs to document nodes. The reasons you might want to do this are:

In general, it is better to not call clear_document_pool, as you will then get better performance if you reuse a document (for example, by using the document() function), as the transformer will not have to parse the document afresh.