# Streamable path expressions

The expression used as an argument to the `saxon:stream` function must consist of:

1. A call to the `document()` or `doc()` function, followed by

2. A streamable pattern

Streamable patterns use a subset of XPath expression corresponding roughly to the rules for match patterns in XSLT (the reason for this is that both subsets are designed to make it efficient to test an individual node for membership of the selected set of nodes). There are some extensions and some restrictions.

- Unlike XSLT match patterns, streamable patterns are not allowed to perform arbitrary navigation within a predicate. For example, `employee[id = preceding-sibling::employee/id]` is not allowed.

  More specifically, the predicate must not be positional (that is, it must not evaluate to a number, and must not call `position()` or `last()`), and it must only use downward selection from the context node (the self, child, attribute, descendant, descendant-or-self, or namespace axes)

- The streamable pattern that follows `doc()/` in the argument to `saxon:stream` must be a relative path: unlike XSLT match patterns, it may not start with "/" or "//" or with a call to the `key()` or `id()` function.

- Some of the restrictions in XSLT match patterns are relaxed, however: for example, the descendant axis can be used.

Next