Package: xpath-sys

Macro define-extension

Lambda List

define-extension (name uri &optional documentation)

Arguments

  • name -- the name of XPath extension (a symbol)
  • uri -- URI corresponding to XPath extension (a string)
  • documentation -- documentation string for the XPath extension

Details

Defines an XPath extension with specified name and uri.

An XPath extension is a collection of XPath functions that are defined using one of define-xpath-function/lazy, define-xpath-function/eager or define-xpath-function/single-type macros. In order to use the extension, one must bind a prefix string to its uri using with-namespaces macro.

Example:
   (defparameter *my-namespace* "http://example.net/my-xpath-extension")

(xpath-sys:define-extension my-ext *my-namespace* "My Extension")

(xpath-sys:define-xpath-function/single-type my-ext add-quotes string (string) (concat "\"" string "\""))

(defun get-my-quoted-string(doc) (with-namespaces (("my" *my-namespace*)) (evaluate "add-quotes(//some-element)" doc)))
 

See also