2004
Colin Adams and others
Colin
Adams
colin@colina.demon.co.uk Tuesday, October 19th, 2004

# The Output URI Resolver

This interface 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.

## Features

security_manager

  The `XM_XSLT_SECURITY_MANAGER` is an interface which allows pluggable security policies. When the output resolver's resolve routine is called, it in turn is supposed to call is_output_uri_permitted on the security manager, to check that it is permitted to write to the URI in question.

output_destinations

  This is a map of output URIs to the `XM_XSLT_TRANSFORMATION_RESULT`s allocated to them. This is particularly useful when the principal output destination is to a `STRING` (selected by a `string:` URI), and the href attribute of xsl:result-document supplies a relative URL. In this case, the output resolver will allocate a `XM_XSLT_TRANSFORMATION_RESULT` that wraps a `STRING`. The Eiffel programmer can then retrieve this as it is indexed by the absolute URI. For example, if the principal output destination (as supplied by the Eiffel programmer) is `string:`, and the stylesheet specifies `href="one"`, then the absolute URI is `string:/one`, and this can be used to retrieve the `XM_XSLT_TRANSFORMATION_RESULT`, and hence the `STRING`.

  This map is also used to ensure that no attempt is made to write two different result trees to the same destination URI.

resolve

  This routine is called to create an `XM_XSLT_TRANSFORMATION_RESULT` for the output destination. But first, it must check with the security manager for permission to write to the URI.

  If resolution is successful, last_result must be set to the created `XM_XSLT_TRANSFORMATION_RESULT`, which must also stored in output_destinations. If resolution is not successful, then error_message must be set to an explanatory message.

close

  This routine is called when the result tree has been completely written to the output destination. It can perform actions such as closing the output stream where appropriate, and might also be used for firing off other actions, such as letting a job scheduler know that an output file is available.

## The default output resolver: `XM_XSLT_DEFAULT_OUTPUT_URI_RESOLVER`

This is the only concrete output resolver provided by the library. If it is not suitable for your needs, then you must write your own, and supply it as the third argument to `XM_XSLT_CONFIGURATION`'s creation procedure, make.

This output resolver handles resolve requests by passing them to an instance of `XM_XSLT_OUTPUT_URI_SCHEME_RESOLVER`, according to the scheme of the URI concerned.

The resolver comes pre-configured with handlers for the `file`, `stdout`, and `string` protocols. The latter two are Gobo-specific protocols, for writing to the standard output stream and a `STRING`, repectively.

Support for additional schemes may be added by calling register_scheme.