The stm:basis operation generates the basis set for the given xpath. In linear algebra the basis is the
set of unique values from which all others can be composed. stm:basis computes the unique document for a given
xpath.
Sounds complex but it's not so bad and is very useful. Say you want to know the set of unique values of, for example,
@type
attribute in a document. Use stm:basis with xpath="//@type"
. It's then easy to transform
that result into say an XHTML form select element.
What if you wanted to know the set of unique instructions used in an idoc? Use xpath="/descendant::type/text()"
.
Or the set of unique customers from a list of multiple orders - use something like xpath="/orders/order/customer/name/text()"
With declarative processing of XML it is very useful to be able to examine the fundamental structure of
a document without the noise of the data. Using xpath="//*"
returns the skeleton document
without it's data.
stm:basis works with any xpath location these can be elements, text or attributes or any combination.