Configuring the XSLT processor

PreviousNext

The configuration of the processor is controlled by XM_XSLT_CONFIGURATION. This has two creation procedures, make and make_with_defaults. The latter creation procedure takes no arguments, and sets up convenient defaults (as used by the command-line processor gexslt). We will look in detail at the arguments to make.

The Entity Resolver

The first argument is an XM_URI_EXTERNAL_RESOLVER, for use by the XML parser to resolve PUBLIC and SYSTEM external identifiers. make_with_defaults uses a catalog resolver, XM_CATALOG_RESOLVER, to look up the external identifiers in an OASIS ETRC XML catalog.

You can disable the actual catalog lookup by inheriting from XM_SHARED_CATALOG_MANAGER and calling shared_catalog_manager.suppress_catalogs. In which case you will get resolution of the SYSTEM identifier, providing it's URI scheme is one of the registered schemes. By default, only file and data are registered. You can register handlers for additional URI schemes by creating a descendant of XM_URI_RESOLVER and passing it as the sole argument to shared_catalog_manager.bootstrap_resolver.uri_scheme_resolver.register_scheme. You can do this even if you don't disable the catalog lookup.

Despite the flexibility of the catalog resolver, you may still want to provide your own resolver (if you want to resolve external entities from a relational database manager, for instance). Just create your own, and pass it as the first argument to make.

The URI Resolver

The second argument is an XM_URI_REFERENCE_RESOLVER. This is used to resolve URIs given by the xsl:include and xsl:import instructions, and the document() function. make_with_defaults passes the same catalog resolver as it does for the first argument, but there is no obligation that the two arguments must receive the same object.

The Output Resolver

The third argument is an XM_XSLT_OUTPUT_URI_RESOLVER. This is used to resolve the destination URI specified by the href attribute of xsl:result-document. It is not used to resolve the principal output destination, as that is under the direct control of the user of the XSLT library, not the stylesheet author.

make_with_defaults passes an XM_XSLT_DEFAULT_OUTPUT_URI_RESOLVER.

The Error Listener

The fourth argument is an XM_XSLT_ERROR_LISTENER. This receives notifications of warnings, recoverable errors and fatal errors.

make_with_defaults passes an XM_XSLT_DEFAULT_ERROR_LISTENER.

The Encoder Factory

The fifth argument is an XM_XSLT_ENCODER_FACTORY. This creates output encoders for the various character encodings supported by the library.

If you need to create output files in an encoding which is not supported by the library, then you will need to create a descendant of XM_XSLT_OUTPUT_ENCODER, and a descendant of XM_XSLT_ENCODER_FACTORY to create your encoder (but better would be to offer your encoder to Gobo, for inclusion in the library, if that is possible for you).

Other features of the configuration

The following other features are of interest to the Eiffel programmer:

set_trace_listener (a_trace_listener: XM_XSLT_TRACE_LISTENER)
This sets the trace_listener. Setting it to a non-Void value turns on stylesheet execution tracing. See XM_XSLT_TRACE_LISTENER for more details.
set_line_numbering (on_or_off: BOOLEAN)
Turns line numbering on and off in diagnostic messages (providing the error listener makes use of the information).
use_tiny_tree_model (true_or_false: BOOLEAN)
Selects use of the tiny tree model for building in-memory representations of XML source documents (not used for the stylsheet). This is supposed to save memory, at the possible expense of execution time.

At present, it seems to leak memory, so avoid it like the plague.

set_digits (digits: INTEGER)
Sets the number of digits to be used when performing decimal arithmetic with XPath expressions. The default is 18 digits, and it may not be set lower than this.
set_external_function_tracing (on_or_off: BOOLEAN)
Sets tracing of binding non-system functions on or off. For debugging purposes only. Output goes to the standard error stream.
set_entity_resolver
Sets the entity resolver for XML parsing.
set_uri_resolver
Set the URI reference resolver for xsl:import/include processing, and for the document() function.
set_recovery_policy (a_recovery_policy: INTEGER)
Sets the recovery policy, but this only has effect on impure error listeners.


Copyright © 2004, Colin Adams and others
mailto:colin@colina.demon.co.uk
http://www.gobosoft.com
Last Updated: Tuesday, October 19th, 2004
HomeTocPreviousNext