<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../../style/element.xsl" ?>
<exslt:element xmlns:exslt="http://exslt.org/documentation" 
               version="1" module="func" status="new">

<exslt:name>script</exslt:name>

<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 ID="func:script">
   <dc:subject>EXSLT</dc:subject>
   <dc:subject>func</dc:subject>
   <dc:subject>script</dc:subject>
   <dc:rights>public domain</dc:rights>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="func:script.1">
         <exslt:version>1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com">Jeni Tennison</dc:creator>
         <dc:date>2001-05-20</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            <p>
               This is an adapted version of <a href="http://www.w3.org/TR/xslt11#element-script"><code>xsl:script</code></a> in the EXSLT - Functions namespace with the following changes.
            </p>
            <ul>
               <li>There are no languages with unqualified names: ECMAScript, Java and Javascript have no particular significance.</li>
               <li>The implementation code must be in a separate document from the stylesheet.</li>
            </ul>
         </dc:description>
      </rdf:Description>
   </exslt:revision>
</rdf:Description>

<exslt:doc xmlns:html="http://www.w3.org/1999/xhtml">
   <html:div xmlns="http://www.w3.org/1999/xhtml">
      <p>
         The top-level <code>func:script</code> 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 <code>func:script</code>.
      </p>
      <p>
         The <code>implements-prefix</code> attribute specifies a namespace prefix. This prefix is expanded into a URI using the namespace declarations in scope on the <code>func:script</code> 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.
      </p>
      <p>
         The <code>language</code> 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 <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName" class="offsite">QName</a>. If the <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName" class="offsite">QName</a> and must have a prefix.  The <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName" class="offsite">QName</a> is expanded into an expanded-name as described in [<a href="http://www.w3.org/TR/xslt#qname" class="offsite">2.4 Qualified Names</a>] of [<a href="http://www.w3.org/TR/xslt" class="offsite">XSLT</a>]; 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. <code>func:script</code> elements with language values not supported by the processor are ignored.
      </p>
      <p>
         The content of the <code>func:script</code> element must be empty and the <code>src</code> attribute is required. The <code>src</code> attribute is a URI reference that identifies the resource containing the implementation of the extension functions. For example,
      </p>
      <ul>
         <li>A Java class: <code>src="java:com.example.datestuff.DateRoutines"</code></li>
         <li>An ECMAScript library: <code>src="http://example.org/somecode.js"</code></li>
      </ul>
      <p>
         The <code>archive</code> 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.
      </p>
      <p>
         The <code>function-available</code> function can be used to detect the availability of an extension function provided by an <code>func:script</code> element. The precise details of what it means for an extension function to be available is specific to the language-binding.
      </p>
      <p>
         A stylesheet can contain any number of <code>func:script</code> 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 <code>func:script</code> elements that provide implementations of those extension functions.
      </p>
      <p>
         If there are multiple <code>func:script</code> 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.
      </p>
      <p>
         If there are multiple <code>func:script</code> 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 <code>func:script</code> element with the highest import precedence; others may merge the <code>func:script</code> elements in some way. It is an error for two <code>func:script</code> 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 <code>func:script</code> elements as if the <code>func:script</code> element that occurs later in the stylesheet had a higher import precedence than the other <code>func:script</code> element.
      </p>
   </html:div>
</exslt:doc>

<exslt:definition xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:attribute name="implements-prefix" use="required" type="xsl:ncname" />
   <xs:attribute name="language" use="required" type="xsl:qname-and-not-ncname" />
   <xs:attribute name="src" type="xsl:uri-reference" use="required" />
   <xs:attribute name="archive" type="xsl:uri-reference" />
</exslt:definition>

<exslt:implementations />

<exslt:use-cases />

</exslt:element>