For some cases Serna employs so called Simple Match Patterns for matching elements in context. Simple Match Patterns resemble the XSLT match patterns, albeit very simplified:
pattern := norm_pattern | '!' norm_pattern // negation norm_pattern := elem_pattern | // element path elem_pattern '/' '@' QNAME | // path/@attr '@' QNAME // @attr elem_pattern := pattern_token | pattern_token '/' elem_pattern pattern_token:= QNAME | '*'
In the above example '!' sign stands for negation, '@' for attribute, '/' is a path (ancestor) separator. Patterns are matched from right to left.
Matching precedence rules:
rule precedence is calculated by adding precedences of matched path components: QNAME has precedence 1 * has precedence 0 (as a result, longest exact matches have the higher precedence)
non-negating rules have precedence over negating rules when their calculated precedences are equal.