2004
Colin Adams and others
Colin
Adams
colin@colina.demon.co.uk Wednesday, November 24th, 2004

# Extensions

All extensions are in the namespace `http://www.gobosoft.com/eiffel/gobo/gexslt/extension`.

## Extension attributes

The following extension attributes are available:

explain

  This attribute may be set on any instruction in the stylesheet, or on a literal result element. The permitted values are "yes", "no" and "all". If the value is "yes", then at compile time an analysis of all XPath expressions appearing as attributes of that element is written to the standard error stream. The analysis includes the static type of the expression, and a representation of the expression tree that results from parsing and optimization. The tree structure is represented by indentation.

  The value of "all" only takes effect on xsl:stylesheet and xsl:transform elements. It is treated as if "yes" was coded. Additionally, if this is the prinicpal stylesheet, then the instructions themselves, when compiled to an expression, have their compiled form displayed. (Only xsl:templates, top-level xsl:variables and xsl:params, and xsl:function definitions are displayed.)

  This can produce a lot of output.

memo-function

  This attribute may be set on any xsl:function declaration in the stylesheet. The permitted values are "yes" and "no". If the value is "yes", then the result of calling the function with a given set of parameters is cached.

  This should not be set to "yes" if the function has any side effects (which can only occur if it uses user-written extension functions with side-effects), or if it access context information, such as position(), last() or the context item.

  If the function constructs and returns a temporary tree, the same tree will be returned each time. The only consequence of this is if you compare node identities on that tree.

character-representation

  This tells the serializer how to serialize non-ASCII characters, and characters that are not representable in the selected encoding.

  When the output method is "xml" or "xhtml"

  (Hm.maybe xhtml should follow the html behaviour)

  , this parameter only effects characters that are not representable in the selected encoding. It can take on the value "hex" or "decimal", and it determines whether the character is written out with a decimal character reference, or a hexadecimal character reference (the default).

  When the output method is "html", then the value may hold two strings, separated by a semicolon. The first string defines how non-ASCII characters within the character encoding will be represented, the values being "native", "entity", "decimal", or "hex". The second string defines how characters outside the encoding will be represented, the values being "entity", "decimal", or "hex". Here "native" means output the character as itself; "entity" means use a defined entity reference (such as "&eacute;") if known; "decimal" and "hex" refer to numeric character references. For example "entity;decimal" (the default) means that with encoding="iso-8859-1", characters in the range 160-255 will be represented using standard HTML entity references, while Unicode characters above 255 will be represented as decimal character references.

  This parameter has no meaning when the output method is "text". For QName output methods, it's interpretation is up to the programmer of the method, but the possible values are those for the "html" method.

indent-spaces

  This tells the serializer how many spaces to add for indentation when indent="yes" is specified. It is ignored when indent="no" is specified, or is omitted and the default for the serialization method is "no". If you omit this parameter, then three spaces are used (but check the creation procedure for `XM_XSLT_OUTPUT_PROPERTIES` to confirm this, in case it gets changed and I forget to update the documentation).

next-in-chain

  To be documented. (See the programs in $GOBO/test/xml/xslt for an example of how to use it).

## User-defined data elements

The only user-defined data element provided by the library is collation. This is intended for declaring collation-URI names, but as the only collation supported is the default one at the moment, it is not much use (I use it for binding additional URIs to the default collation, to test the collation-naming mechanism). When a tailorable collation based on the Unicode Collation Algorithm is available, then this will be used to bind URI names to tailored collations.

## Extension instructions

None are provided at present.

## Additional output methods

None are provided in the extension namespace.

However, there is an example provided to show Eiffel programmers how to write their own output methods. This is in the namespace `http://www.gobosoft.com/eiffel/gobo/gexslt/extension/example`, and has a local name of xml. It functions identically to the standard xml method, unless the extension attribute internal-subset (in the same namespace) is supplied. In which case, it's value is used as the text for a DTD internal subset. You must also supply doctype-system for this to work.

## Extension functions

None are provided at present.