EXSLT - func:script

Implementer Page: func.script.html
Element Package: func.script.zip

Element Syntax

<func:script
   implements-prefix = ncname
   language = qname-and-not-ncname
   src = uri-reference
   archive = uri-reference />

The top-level func:script element provides an implementation of extension functions in a particular namespace. The function implementations may be provided as a separate resource. Some language bindings also allow the function implementations to be provided directly in the content of the func:script.

The implements-prefix attribute specifies a namespace prefix. This prefix is expanded into a URI using the namespace declarations in scope on the func:script element. This URI is the namespace URI of the expanded-names of the functions of which an implementation is being provided. The implementation of the extension functions identifies the local names of the functions that is is implementing.

The language attribute identifies the language used by the implementation being provided. It also identifies the way arguments are passed by the XSLT processor to the implementation of the extension function, the way results are returned from the implementation of the extension function, and the way the XSLT expression context is made available to the extension function (collectively known as the language binding). The value must be a QName. If the QName and must have a prefix. The QName is expanded into an expanded-name as described in [2.4 Qualified Names] of [XSLT]; the expanded-name identifies the language binding; the language binding in this case is not specified by this document. XSLT processors are not required to support any particular language binding. func:script elements with language values not supported by the processor are ignored.

The content of the func:script element must be empty and the src attribute is required. The src attribute is a URI reference that identifies the resource containing the implementation of the extension functions. For example,

  • A Java class: src="java:com.example.datestuff.DateRoutines"
  • An ECMAScript library: src="http://example.org/somecode.js"

The archive attribute is a whitespace-separated list of URI references, each pointing to an archive to be loaded by the processor before executing the extension function.

The function-available function can be used to detect the availability of an extension function provided by an func:script element. The precise details of what it means for an extension function to be available is specific to the language-binding.

A stylesheet can contain any number of func:script elements. The order of these elements is not significant in the stylesheet, except for fallback behavior. In particular, calls to extension function can occur before func:script elements that provide implementations of those extension functions.

If there are multiple func:script elements with the same namespace URI but different implementation languages, then each implementation language corresponds to an alternative implementation of the same extension functions. If an XSLT processor supports two or more of the languages in which an extension function implementation is provided, then it is free to choose any of its supported languages, provided that it always chooses the same implementation for the same extension function namespace URI. A processor is under no obligation to choose the same implementation each time a document is transformed.

If there are multiple func:script elements with the same namespace URI and the same language but different import precedences, a processor must reconcile the separate elements using the import precedence. The manner in which the elements are reconciled is determined by the language binding. For example, some language bindings may simply use the func:script element with the highest import precedence; others may merge the func:script elements in some way. It is an error for two func:script elements with the same import precedence to implement the same namespace URI for the same language. An XSLT processor may signal the error; if it does not signal the error, it must recover by treating the two func:script elements as if the func:script element that occurs later in the stylesheet had a higher import precedence than the other func:script element.

Implementations

There are currently no XSLT processors that we know of that support func:script natively.

There are currently no third-party implementations of func:script.

http://www.exslt.org/func/elements/script/index.html last modified 2001-05-20