2004
Colin Adams and others
Colin
Adams
colin@colina.demon.co.uk Monday, October 18th, 2004

# Overview of the XSLT library

This chapter gives Eiffel programmers an introduction to the Gobo Eiffel XSLT library, which implements the World Wide Web Consortium's XSLT 2.0 tranformation language.

The library supports a Basic XSLT processor, and is in line with the Proposed Recommendation.

The support is not yet quite complete. The following features have yet to be implemented:

- Regular expressions do not yet support Unicode data (ASCII support only).

- The functions unparsed-text() and unparsed-text-available() do not work properly yet. They will probably work OK for 7-bit ASCII and UTF-8 files.

- The functions lower-case() and upper-case() only use simple case mappings (one's that don't change the string length).

See Examples for examples of how to use the library.

## Invoking XSLT

- The first step involved in using the XSLT library, is to set the conformance level. At present, only Basic XSLT Processor is supported. In the future, we hope to add support for Schema-Aware XSLT Processor, so the first step is to inherit from `XM_XPATH_SHARED_CONFORMANCE` and call conformance.set_basic_xslt_processor.

- The next step is to configure the processor, by creating an `XM_XSLT_CONFIGURATION`.

- The next step is Creating a Transformer.

- The next step is Executing the Transformation.

- Finally, Accessing the Transformation Results.

## Customizable interfaces

The following is a list of XSLT interfaces that the Eiffel programmer may need to implement. In all cases, the library provides at least one concrete implementation.

- `XM_XSLT_OUTPUT_URI_RESOLVER`

- `XM_XSLT_ERROR_LISTENER`

- `XM_XSLT_TRACE_LISTENER`

- `XM_XSLT_TRANSFORMATION_RESULT`

- `XM_XSLT_SOURCE`

- `XM_XSLT_ENCODER_FACTORY` is explained in `XM_XSLT_CONFIGURATION`.

- `XM_XSLT_MESSAGE_EMITTER_FACTORY` is explained in `XM_XSLT_CONFIGURATION`.

## Extensions

XSLT and XPath provide for standard mechanisms to access extensions to the language. This library provides some built-in extensions in the namespace `http://www.gobosoft.com/eiffel/gobo/gexslt/extension`. In order to make use of them, you must provide a namespace declaration in your stylesheets, something like: gexslt:xmlns="http://www.gobosoft.com/eiffel/gobo/gexslt/extension". Don't forget to exclude this namespace from your result documents with: exclude-result-prefixes="gexslt" when appropriate.

You can also provide your own extensions. In this case, you should allocate a namespace URI that you control to your extensions.

In some cases (notably output extensions), the mechanism for accessing built-in extensions differs slightly from that for user-written extensions. In these cases, I have incorporated example classes into the library so you can see how to code your own extensions. These examples are all in the namespace `http://www.gobosoft.com/eiffel/gobo/gexslt/extension/example`.

Output extensions

Other extensions

## Compiling programs which use the XSLT library

To see which libraries need to be mounted in your system.xace file, take a look at the example progam in $GOBO/example/xml/xslt/schematron.

## Conformance

See Conformance to standards