<cRefPattern>

<cRefPattern> (canonical reference pattern) specifies an expression and replacement pattern for transforming a canonical reference into a URI. 2.3.5.3 Milestone Method 2.3.5 The Reference System Declaration 2.3.5.2 Search-and-Replace Method
Moduleheader — 2 The TEI Header
Attributesatt.global (@xml:id, @n, @xml:lang, @rend, @rendition, @xml:base, @xml:space) (att.global.linking (@corresp, @synch, @sameAs, @copyOf, @next, @prev, @exclude, @select)) (att.global.analytic (@ana)) (att.global.facs (@facs)) (att.global.change (@change))
matchPatternspecifies a regular expression against which the values of cRef attributes can be matched.
Status Required
Datatype

<rng:ref name="data.pattern"/>
data.pattern
Values must be a regular expression according to the W3C XML Schema Language
Note
Parenthesised groups are used not only for establishing order of precedence and atoms for quantification, but also for creating subpatterns to be referenced by the replacementPattern attribute.
replacementPatternspecifies a ‘replacement pattern’ which, once subpattern substitution has been performed, provides a URI.
Status Required
Datatype

<rng:text/>
text
Values Should be the skeleton of a relative or absolute URI, with references to groups in the matchPattern.
Note
The strings ‘$1’ through ‘$9’ are references to the corresponding group in the regular expression specified by matchPattern (counting open parenthesis, left to right). Processors are expected to replace them with whatever matched the corresponding group in the regular expression.
If a digit preceded by a dollar sign is needed in the actual replacement pattern (as opposed to being used as a back reference), the dollar sign must be written as %24.
Used by
Contained by
header: refsDecl
May contain
core: p
linking: ab
Declaration

<rng:element name="cRefPattern">
 <rng:ref name="att.global.attributes"/>
 <rng:ref name="att.global.linking.attributes"/>
 <rng:ref name="att.global.analytic.attributes"/>
 <rng:ref name="att.global.facs.attributes"/>
 <rng:ref name="att.global.change.attributes"/>
 <rng:attribute name="matchPattern">
  <rng:ref name="data.pattern"/>
 </rng:attribute>
 <rng:attribute name="replacementPattern">
  <rng:text/>
 </rng:attribute>
 <rng:zeroOrMore>
  <rng:ref name="model.pLike"/>
 </rng:zeroOrMore>
</rng:element>
element cRefPattern
{
   att.global.attributes,
   att.global.linking.attributes,
   att.global.analytic.attributes,
   att.global.facs.attributes,
   att.global.change.attributes,
   attribute matchPattern { data.pattern },
   attribute replacementPattern { text },
   model.pLike*
}
Example
<cRefPattern
  matchPattern="([1-9A-Za-z]+)\s+([0-9]+):([0-9]+)"
  replacementPattern="#xpath(//div[@type='book'][@n='$1']/div[@type='chap'][@n='$2']/div[@type='verse'][@n='$3'])"/>
Note
The result of the substitution may be either an absolute or a relative URI reference. In the latter case it is combined with the value of xml:base in force at the place where the cRef attribute occurs to form an absolute URI in the usual manner as prescribed by XML Base.