# XPath Changes

The "?" in the SequenceType syntax `element(N, T?)` or `element(*, T?)` is now implemented. Without the "?", the test does not match an element that has `xsi:nil="true"`. Similarly, the syntax `schema-element(N)` no longer matches an element with `xsi:nil="true"`.

The SequenceType syntax `document-node(element(N,T))` or `document-node(schema-element(N))` is now supported in all contexts, including within a step of a path expression.

The SequenceType syntax `void()` (previously `empty()`) has changed again: it is now `empty-sequence()`. Saxon currently allows `void()` and `empty-sequence()` as synonyms.

The tokenizer now disallows constructs of the form `10div 3`: that is, a numeric literal must now be separated by whitespace from a following operator keyword.

The expression optimizer now recognizes constructs that can be speeded up by indexing, and builds the necessary indexes automatically. This works both in XSLT and in XQuery. This optimization is available in Saxon-SA only. There are two constructs that are recognized as candidates for indexing. Firstly, the optimizer recognizes an absolute path expression (one starting at a document node) containing a predicate that is an equality match between a value that depends on the context node and a value that doesn't depend on the path, or an equivalent FLWOR expression in XQuery. This causes a document-level index to be built - in effect, an implicit `xsl:key` declaration. Such indexes last as long as the document stays in memory, and can be shared by multiple queries executing against the same document. Secondly, the optimizer recognizes similar path expressions whose first term is a variable reference, provided that the path expression is itself in a loop relative to the variable binding. This causes the value of the variable to be indexed: this index lasts only as long as the variable itself.

Next