Liking cljdoc? Tell your friends :D

sigel.xpath.core

Functions for selecting and matching things in an XML file with XPath.

For examples, see the function-specific documentation for each function. The examples assume you've required this namespace:

(require '[sigel.xpath.core :as xpath])

Every function in the sigel.xpath.core namespace that select or match things in an XML document rely on an XPathCompiler.

If you don't pass in your own XPathCompiler as the first argument to a function like that, they use *compiler*.

Use variables in XPath expression or pattern

If you need to use variables in your XPath expression or pattern, you can pass a map of variables as the last argument to your XPath operation.

The map key must implement the QNameable protocol. The value must implement the XMLValue protocol.

If you use variables, you also need to pass in an XPathCompiler as the first argument, because setting a variable mutates the XPathCompiler instance.

Example:

(def my-compiler (xpath/compiler))

(xpath/is? my-compiler "<num>1</num>" "xs:integer(num) * $two eq 2" {:two 2})
Functions for selecting and matching things in an XML file with XPath.

For examples, see the function-specific documentation for each function. The
examples assume you've required this namespace:

```
(require '[sigel.xpath.core :as xpath])
```

Every function in the `sigel.xpath.core` namespace that select or match things
in an XML document rely on an [XPathCompiler].

If you don't pass in your own `XPathCompiler` as the first argument to a
function like that, they use [`*compiler*`][dyn-compiler].

## Use variables in XPath expression or pattern

If you need to use variables in your XPath expression or pattern, you can pass
a map of variables as the last argument to your XPath operation.

The map key must implement the [QNameable] protocol. The value must implement
the [XMLValue] protocol.

If you use variables, you also need to pass in an `XPathCompiler` as the first
argument, because setting a variable mutates the `XPathCompiler` instance.

Example:

```
(def my-compiler (xpath/compiler))

(xpath/is? my-compiler "<num>1</num>" "xs:integer(num) * $two eq 2" {:two 2})
```

[XPathCompiler]: http://www.saxonica.com/html/documentation/javadoc/net/sf/saxon/s9api/XPathCompiler.html

[dyn-compiler]: sigel.xpath.core.html#var-*compiler*
[xpath-api]: sigel.xpath.core.html

[QNameable]: sigel.protocols.html#var-QNameable
[XMLValue]: sigel.protocols.html#var-XMLValue
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close