Facilities for defining Saxon integrated extension functions.
Facilities for defining Saxon [integrated extension functions](http://www.saxonica.com/html/documentation/extensibility/integratedfunctions/).
(function qname arg-types result-type body)
Define a Saxon integrated extension function.
Example:
(require '[sigel.extension :as ext])
(ext/function
["local" "double"] ;; the namespace URI and local name
[[:one :int]] ;; the argument types
[:one :double] ;; the result type
(fn [x] (double (* x 2)))) ;; body
The argument and result types of the extension function are defined as tuples
of an OccurrenceIndicator
and ItemType,
but as Clojure :keywords
instead of Java CONSTANTS
.
For example, ONE
becomes :one
, ANY_NODE
becomes :any-node
etc.
Define a Saxon integrated extension function. Example: ``` (require '[sigel.extension :as ext]) (ext/function ["local" "double"] ;; the namespace URI and local name [[:one :int]] ;; the argument types [:one :double] ;; the result type (fn [x] (double (* x 2)))) ;; body ``` The argument and result types of the extension function are defined as tuples of an [OccurrenceIndicator](http://www.saxonica.com/html/documentation/javadoc/net/sf/saxon/s9api/OccurrenceIndicator.html) and [ItemType](www.saxonica.com/html/documentation/javadoc/net/sf/saxon/s9api/ItemType.html), but as Clojure `:keywords` instead of Java `CONSTANTS`. For example, `ONE` becomes `:one`, `ANY_NODE` becomes `:any-node` etc.
(make-sequence-type occurrence-indicator item-type)
A wrapper for SequenceType/makeSequenceType
. Takes arguments in the reverse
order to the original method because it's more pleasant to write
[:one :boolean]
than [:boolean :one]
.
A wrapper for [`SequenceType/makeSequenceType`](http://www.saxonica.com/html/documentation/javadoc/net/sf/saxon/s9api/SequenceType.html). Takes arguments in the reverse order to the original method because it's more pleasant to write `[:one :boolean]` than `[:boolean :one]`.
(register-extension-function! host function)
Register a Saxon integrated extension function.
You can use function
to define an integrated extension function.
host
can be a Saxon Processor
, XPathCompiler
, or XsltCompiler
.
Register a Saxon integrated extension function. You can use [[function]] to define an integrated extension function. `host` can be a Saxon `Processor`, `XPathCompiler`, or `XsltCompiler`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close