Example: <cRefPattern> (canonical reference pattern)

These search results reproduce every example of the use of <cRefPattern> in the Guidelines, including all localised and translated versions. In some cases, the examples have been drawn from discussion of other elements in the Guidelines and illustrating the use of <cRefPattern> is not the main focus of the passage in question. In other cases, examples may be direct translations of each other, and hence identical from the perspective of their encoding.

2 The TEI Header


<teiHeader>

<teiHeader>
 <fileDesc>
  <titleStmt>
   <title>Shakespeare: the first folio (1623) in electronic form</title>
   <author>Shakespeare, William (1564–1616)</author>
   <respStmt>
    <resp>Originally prepared by</resp>
    <name>Trevor Howard-Hill</name>
   </respStmt>
   <respStmt>
    <resp>Revised and edited by</resp>
    <name>Christine Avern-Carr</name>
   </respStmt>
  </titleStmt>
  <publicationStmt>
   <distributor>Oxford Text Archive</distributor>
   <address>
    <addrLine>13 Banbury Road, Oxford OX2 6NN, UK</addrLine>
   </address>
   <idno type="OTA">119</idno>
   <availability>
    <p>Freely available on a non-commercial basis.</p>
   </availability>
   <date when="1968">1968</date>
  </publicationStmt>
  <sourceDesc>
   <bibl>The first folio of Shakespeare, prepared by Charlton Hinman (The Norton Facsimile,
       1968)</bibl>
  </sourceDesc>
 </fileDesc>
 <encodingDesc>
  <projectDesc>
   <p>Originally prepared for use in the production of a series of old-spelling
       concordances in 1968, this text was extensively checked and revised for use during the
       editing of the new Oxford Shakespeare (Wells and Taylor, 1989).</p>
  </projectDesc>
  <editorialDecl>
   <correction>
    <p>Turned letters are silently corrected.</p>
   </correction>
   <normalization>
    <p>Original spelling and typography is retained, except that long s and ligatured
         forms are not encoded.</p>
   </normalization>
  </editorialDecl>
  <refsDecl xml:id="ASLREF">
   <cRefPattern
     matchPattern="(\S+) ([^.]+)\.(.*)"
     replacementPattern="#xpath(//div1[@n='$1']/div2/[@n='$2']//lb[@n='$3'])">

    <p>A reference is created by assembling the following, in the reverse order as that
         listed here: <list>
      <item>the <att>n</att> value of the preceding <gi>lb</gi>
      </item>
      <item>a period</item>
      <item>the <att>n</att> value of the ancestor <gi>div2</gi>
      </item>
      <item>a space</item>
      <item>the <att>n</att> value of the parent <gi>div1</gi>
      </item>
     </list>
    </p>
   </cRefPattern>
  </refsDecl>
 </encodingDesc>
 <revisionDesc>
  <list>
   <item>
    <date when="1989-04-12">12 Apr 89</date> Last checked by CAC</item>
   <item>
    <date when="1989-03-01">1 Mar 89</date> LB made new file</item>
  </list>
 </revisionDesc>
</teiHeader>

<refsDecl>

<refsDecl>
 <cRefPattern
   matchPattern="([A-Za-z0-9]+) ([0-9]+):([0-9]+)"
   replacementPattern="#xpath(//body/div[@n='$1']/div[$2]/div3[$3])"/>

</refsDecl>

<refsDecl>

<refsDecl xml:id="fr_ASLREF">
 <cRefPattern
   matchPattern="(\S+) ([^.]+)\.(.*)"
   replacementPattern="#fr_xpath(//div1[@n='$1']/div2/[@n='$2']//lb[@n='$3'])">

  <p>Une référence a été créée en assemblant les éléments suivants dans l'ordre inverse de
     la liste qui suit : <list>
    <item>la valeur <att>n</att> du précédent <gi>lb</gi>
    </item>
    <item>une période</item>
    <item>la valeur <att>n</att> de l'ancêtre <gi>div2</gi>
    </item>
    <item>un espace</item>
    <item>la valeur<att>n</att> du parent <gi>div1</gi>
    </item>
   </list>
  </p>
 </cRefPattern>
</refsDecl>

<cRefPattern>

<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'])"/>

3 Elements Available in All TEI Documents


3.10.4 Declaring Reference Systems

<encodingDesc>
 <refsDecl>
  <cRefPattern
    matchPattern="([^ ]+) ([0-9]+)\.([0-9]+)\.([0-9]+)"
    replacementPattern="#xpath(//div1[@n='$1']/div2[@n='$2']/div3[@n='$3']/l[@n='$4']">

   <p>A canonical reference is assembled with
   <list>
     <item>the name of the <label>work</label>: the
     <att>n</att> of a <gi>div1</gi>,</item>
     <item>a space,</item>
     <item>the number of the <label>book</label>: the
     <att>n</att> of a child <gi>div2</gi>,</item>
     <item>a full stop</item>
     <item>the number of the <label>poem</label>: the
     <att>n</att> of a child <gi>div3</gi>,</item>
     <item>the line number: the <att>n</att> value of a
           child <gi>l</gi>
     </item>
    </list>
   </p>
  </cRefPattern>
  <cRefPattern
    matchPattern="([^ ]+) ([0-9]+)\.([0-9]+)"
    replacementPattern="#xpath(//div1[@n='$1']/div2[@n='$2']/div3[@n='$3']">

   <p>Same as above, but without the last component (full
       stop followed by the <gi>l</gi>'s <att>n</att>.</p>
  </cRefPattern>
  <cRefPattern
    matchPattern="([^ ]+) ([0-9]+)"
    replacementPattern="#xpath(//div1[@n='$1']/div2[@n='$2']">

   <p>Same as above, but without the poem component (full
       stop followed by the <gi>div3</gi>'s <att>n</att>.</p>
  </cRefPattern>
 </refsDecl>
</encodingDesc>

3.10.4 Declaring Reference Systems

<refsDecl>
 <cRefPattern
   matchPattern="([^ ]+ [0-9]+\.[0-9]+\.[0-9]+)"
   replacementPattern="#xpath(//l[@n='$1')"/>

</refsDecl>

3.10.4 Declaring Reference Systems

<refsDecl>
 <cRefPattern
   matchPattern="([^ ]+ [0-9]+\.[0-9]+\.[0-9]+)"
   replacementPattern="#xpath(//l[@n='$1')"/>

 <cRefPattern
   matchPattern="([^ ]+ [0-9]+\.[0-9]+)"
   replacementPattern="#xpath(//div2[@n='$1')"/>

</refsDecl>

3.10.4 Declaring Reference Systems

<refsDecl>
 <cRefPattern matchPattern="(.*)" replacementPattern="#$1"/>
</refsDecl>

16 Linking, Segmentation, and Alignment


16.2.5 Canonical References

<refsDecl xml:id="biblical">
 <cRefPattern
   matchPattern="(.+) (.+):(.+)"
   replacementPattern="#xpath1(//div[@n='$1']/div[$2]/div[$3])">

  <p>This pointer pattern extracts and references the <q>book,</q>
   <q>chapter,</q> and <q>verse</q> parts of a biblical reference.</p>
 </cRefPattern>
 <cRefPattern matchPattern="(.+) (.+)"
   replacementPattern="#xpath1(//div[@n='$1']/div[$2])">

  <p>This pointer pattern extracts and references the <q>book</q> and
  <q>chapter</q> parts of a biblical reference.</p>
 </cRefPattern>
 <cRefPattern matchPattern="(.+)"
   replacementPattern="#xpath1(//div[@n='$1'])">

  <p>This pointer pattern extracts and references just the <q>book</q>
     part of a biblical reference.</p>
 </cRefPattern>
</refsDecl>

16.2.5.1 Worked Example

<cRefPattern
  matchPattern="(.+) (.+):(.+)"
  replacementPattern="//div[@n='$1']/div[$2]/div[$3]/p[$4]"/>

16.2.5.2 Complete and Partial URI Examples

<refsDecl xml:id="USC">
 <cRefPattern
   matchPattern="([0-9][0-9])\s*U\.?S\.?C\.?\s*[Cc](h(\.|ap(ter|\.)?)?)?\s*([1-9][0-9]*)"
   replacementPattern="http://uscode.house.gov/download/pls/$1C$5.txt">

  <p>Matches most standard references to particular
     chapters of the United States Code, e.g.
  <val>11USCC7</val>, <val>17 U.S.C. Chapter 3</val>, or
  <val>14 USC Ch. 5</val>. Note that a leading zero is
     required for the title (must be two digits), but is not
     permitted for the chapter number.</p>
 </cRefPattern>
 <cRefPattern
   matchPattern="([0-9][0-9])\s*U\.?S\.?C\.?\s*[Pp](re(lim(inary)?)?)?\s*[Mm](at(erial)?)?"
   replacementPattern="http://uscode.house.gov/download/pls/$1T.txt">

  <p>Matches references to the preliminary material for a
     given title, e.g. <val>11USCP</val>, <val>17 U.S.C.
       Prelim Mat</val>, or <val>14 USC pm</val>.</p>
 </cRefPattern>
 <cRefPattern
   matchPattern="([0-9][0-9])\s*U\.?S\.?C\.?\s*[Aa](ppend(ix)?)?"
   replacementPattern="http://uscode.house.gov/download/pls/$1A.txt">

  <p>Matches references to the appendix of a given tile,
     e.g. <val>05USCA</val>, <val>11 U.S.C. Appendix</val>,
     or <val>18 USC Append</val>.</p>
 </cRefPattern>
</refsDecl>
<!-- ... -->
<p>The example in section <ptr target="#SABN"/> is taken
from <ref cRef="17 USC Ch 1">Subject Matter and Scope of
   Copyright</ref>.</p>