I notice that @matchPattern in att.patternReplacement is defined in terms of the W3C XML Schema Language, but that definition states that it "implicitly anchors all regular expressions at the head and tail" meaning that regular expressions following it will only match the whole input string, not some part of it. I'm not sure that's implied by the discussion around cRefPattern in the Guidelines (though it certainly works for prefixDef). The example at http://www.tei-c.org/release/doc/tei-p5-doc/en/html/SA.html#SACRWE works, because all of the references are wrapped in
<val> elements (which itself seems like a misuse, shouldn't it be
<ref>?), but I don't see anywhere a note that canonical references must be so contained.
If implicit anchoring is not a desired attribute of @matchPatterns, then might http://www.w3.org/TR/xpath-functions/#regex-syntax be a better syntax definition?