Indexation of rule comparison predicates
A common form of template rule pattern predication is
pattern[expr=value], such as
In cases where there are very large numbers of such rules, Saxon can build indexes to decrease the rule pattern matching time. This involves
searching for sets of rules which have predicates that are equality comparisons and collecting together sets with a common LHS of the
comparison and 'base pattern'. (Rules with patterns
foo/*[@type='xs:double'] would be
indexed together to lookup via
@type - if the latter rule was a candidate (
@type='xs:double') a further test
parent::foo would then be applied.). An index is built for any set of rules, with a common indexation base, larger than
index.minUses in size. The comparisons are performed under the default collation for the given template
) - thus two
templates with identical base patterns and comparison LHS, but differing collations, will be indexed separately.
This technique is experimental and should be used only after testing representative documents for correctness by comparing outputs with this indexation feature enabled and disabled. Invoking Saxon-EE through the class com.saxonica.StatsTransform can be used to help and can give indications of the level of any performance improvement to be anticipated. For more details of this analysis tool, see Detailed Pattern-Matching Statistics.