Difference between revisions of "TEI xml"

From Wiki
Jump to navigation Jump to search
m (continuing)
m (continuing)
Line 17: Line 17:
 
<xmlcode>
 
<xmlcode>
 
<?xml version="1.0"?>
 
<?xml version="1.0"?>
 
<?context-directive job ctxfile sophiststei.ctx ?>
 
  
 
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
 
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
Line 56: Line 54:
 
     </front>
 
     </front>
 
     <body>
 
     <body>
       <div xml:id="VS1" n="Α" type="book">
+
       <div xml:id="VS1" n="I" type="book">
<div xml:id="VS1p" n="praef" type="chapter">
+
<div xml:id="VS1" n="1" type="chapter">
  <div xml:id="VS1p1" n="1" type="section">
+
  <div xml:id="VS1.1" n="1" type="section">
 
    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
 
    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
 
    diam nonumy eirmod tempor invidunt
 
    diam nonumy eirmod tempor invidunt
Line 75: Line 73:
 
    nonumy eirmod tempor invidunt.</p>
 
    nonumy eirmod tempor invidunt.</p>
 
  </div>
 
  </div>
  <div xml:id="VS1p2" n="2" rend="inline" type="section">
+
  <div xml:id="VS1.2" n="2" rend="inline" type="section">
 
    <p>ut labore et dolore magna aliquyam erat, sed diam
 
    <p>ut labore et dolore magna aliquyam erat, sed diam
 
    voluptua. <pb ed="Olearius" n="481"/> At vero eos et accusam et
 
    voluptua. <pb ed="Olearius" n="481"/> At vero eos et accusam et
Line 90: Line 88:
 
    amet</p>
 
    amet</p>
 
  </div>
 
  </div>
  <div xml:id="VS1p3" n="3" rend="paragraph" type="section">
+
  <div xml:id="VS1.3" n="3" rend="paragraph" type="section">
 
    <p>Duis autem vel eum iriure dolor in hendrerit in vulputate
 
    <p>Duis autem vel eum iriure dolor in hendrerit in vulputate
 
    velit esse molestie consequat, vel illum dolore eu feugiat
 
    velit esse molestie consequat, vel illum dolore eu feugiat
Line 107: Line 105:
 
</xmlcode>
 
</xmlcode>
  
--[[User:Thomas|Thomas]] 09:03, 10 October 2010 (UTC)
+
So let's have a look at this file. This can be brief since most of the tags are described in the TEI guidelines and tutorials.
 +
 
 +
Every TEI file has as its root level (i.e. the "outer" level of the xml file) the element
 +
 
 +
<xmlcode>
 +
<TEI>
 +
 
 +
</TEI>
 +
</xmlcode>
 +
 
 +
which defines it as a TEI xml file. Everything else is a "child" of this root level. At the next level, you see two of these children: on the one hand, the <teiHeader> element. This contains meta-information about your electronic edition: title, author, editor, publication status, source of your edition. There can be much more information here. This is meta-information which will usually not be typeset in your edition.
 +
 
 +
The other child is the <text> element. This is what will really be in a typeset, printed edition. As you see, this has again two children: the <front>, which contains the title of the work you edit in the form in which it will appear in your typeset document, prefatory material, etc. The <body> element contains the text itself. This text has a logical structure: It consists of books, chapters, and sections. All of these logical parts are expressed via different <div> elements; to distinguish them from each other, these <div> elements have so-called attributes, so we have:
 +
 
 +
<xmlcode>
 +
      <div xml:id="VS1" n="I" type="book">
 +
<div xml:id="VS1p" n="praef" type="chapter">
 +
  <div xml:id="VS1p1" n="1" type="section">
 +
          </div>
 +
        </div>
 +
    </div>
 +
</xmlcode>
 +
 
 +
As you can see, most of these <div> elements have other attributes as well: the "xml:id" attribute gives every section in your document a unique identifier. This makes it easier if you want to refer to these sections later. You are free to choose these attributes; as an example, I have opted for a short numeric tag that refers to the paragraph. The "n" attribute is the name of the section as it will appear in your typeset edition. For classical prose texts, it is customary to have the chapter and section numbers appear in the margin of the edition, with no prefix and no additional information about the structure. E.g., at the beginning of chapter 8, there will be bold '''8''' in the margin (the mark for "section 1" is understood and usually not expressed). For subsequent sections of chapter 8, there will be smaller section numbers in the margin, like "2," "3," etc. Finally, such sections of chapters do not necessarily begin a new paragraph. In order to make this clear, I have used the "rend" attribute (not exactly in the way TEI defines it, but close enough). For sections, I have two types of "rend" attributes" "inline" means that this section should just continue the typographical paragraph; "paragraph" means that it should be begin in a new paragraph. This is an important distinction which I want to emphasize: in your typeset edition, these two will appear very different. For the '''logical''' structure of your digital text, however, they are both on the same level. That's why they are both <div> of the same type, but with different "rend" attributes.
 +
 
 +
--[[User:Thomas|Thomas]] 11:37, 10 October 2010 (UTC)

Revision as of 11:39, 10 October 2010

General

TEI (Text Encoding Initiative) is "a consortium which collectively develops and maintains a standard for the representation of texts in digital form," to quote their own website. They have developed a series of guidelines for editing texts in a digital form. In their latest form (which is called P 5), these guidelines weigh in at a hefty 1350 pages (OK, that's counting the bibliography and the index too; there are only 1290 pages of real text). These describe an xml format which is suitable for editing texts. The TEI guidelines have the advantage of being very well documented. There are a number of free resources available that should help everyone who is interested in getting started (one extremely helpful website with lots of tutorials, examples, and tests is TEI by example). They are not (and do not aspire to be) an absolute standard that everyone has to follow, but many academic projects use these guidelines, and they should be a pretty good way to make sure that your electronic edition of a text will be useful in the future.

Since editing texts is something which quite a few users of ConTeXt are involved in, it makes sense to think about ways in which xml documents which follow the TEI guideline can be typeset with ConTeXt. We would invite users to keep a few caveats in mind:

  1. The TEI guidelines are very detailed because they try to cater to a large number of needs. Most users will only need a small subset of the tags and attributes which the guidelines offer (in fact, TEI is aware of this and have a slimmed down version of their guidelines which is called TEI Lite. This is a very good starting place to familiarize yourself with TEI). It would not make sense to try and provide a monolithic solution that defines all TEI tags; instead, localized ConTeXt style sheets are necessary which will define a subset which is relevant for a number of texts with similar features.
  2. Even with this huge number of tags, TEI does not expect to be sufficient for every text. Users are encouraged to develop their own styles; again, this necessitates special ConTeXt style sheets to process such adaptations.
  3. Encoding and typesetting texts in xml is an ongoing process. As you go forward in your edition, you realize that you need more tags, that you need to distinguish more special cases, that you want to add more information to your edition. This means that you will have to go back and forth between your xml file and the ConTeXt style and adapt both to your needs.

All of which means that the following paragraphs are just the first step in an ongoing attempt. I (Thomas) have written down a setup for a text that I am editing (for those who are interested: the Lives of the Sophists by Philostratus). I fully expect this to be a community effort: as others use TEI xml, they will discover new ways of handling things, will want to add features or add examples for other sorts of texts. My example is meant to start the discussion. Since those who edit texts usually have a background in the humanities, not in programming, I have added lengthy comments which will explain every step.

Our xml file

Philostratus's text is in ancient Greek, but since the text itself doesn't matter much when we talk about structure and typesetting xml, I have replaced it here with a simple lorem ipsum text that is easier to display. So here's what the first paragraphs of the xml file look like:

<?xml version="1.0"?>

<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
  <teiHeader>
    <fileDesc>
      <titleStmt>
	<title>Lives of the Sophists</title>
	<author>Philostratus</author>
	<respStmt>
	  <resp>editor</resp>
	  <name xml:id="TAS">Thomas</name>
	</respStmt>
      </titleStmt>
      <publicationStmt>
	<p>Work in progress</p>
      </publicationStmt>
      <sourceDesc>
	<p>See indication of manuscripts</p>
      </sourceDesc>
    </fileDesc>
  </teiHeader>
  <text>
    <front>
      <div type="sigla">
	<listWit>
	  <witness id="c2">codd. 2</witness>
	  <witness id="Richards">Richards</witness>
	</listWit>
      </div>
      <div type="work">
	<head type="main">Philostrati</head>
	<head type="sub">Vitae Sophistarum.</head>
	<opener>
	  <salute>Lorem <pb ed="Olearius" n="479"/>Ipsum</salute>
	</opener>
      </div>
    </front>
    <body>
      <div xml:id="VS1" n="I" type="book">
	<div xml:id="VS1" n="1" type="chapter">
	  <div xml:id="VS1.1" n="1" type="section">
	    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
	    diam nonumy eirmod tempor invidunt
	    <app>
	      <rdg wit="#Richards">induunt</rdg>
	    </app>
	    ut labore et dolore magna aliquyam erat, sed diam voluptua. At
	    vero eos et accusam et justo duo dolores et ea rebum. Stet
	    clita kasd gubergren
	    <app>
	      <rdg wit="#c2">arrgl</rdg>
	    </app>
	    <pb ed="Olearius" n="480"/>
	    no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
	    ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
	    nonumy eirmod tempor invidunt.</p>
	  </div>
	  <div xml:id="VS1.2" n="2" rend="inline" type="section">
	    <p>ut labore et dolore magna aliquyam erat, sed diam
	    voluptua. <pb ed="Olearius" n="481"/> At vero eos et accusam et
	    justo duo dolores et ea rebum. Stet clita kasd gubergren, no
	    sea takimata sanctus est Lorem ipsum dolor sit amet.
	    <lg>
	      <l>At vero eos et accusam et justo duo dolores</l>
	    </lg>
	    et
	    <lg>
	      <l>ea rebum. Stet clita kasd gubergren, no sea takimata</l>
	    </lg>
	    sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
	    amet</p>
	  </div>
	  <div xml:id="VS1.3" n="3" rend="paragraph" type="section">
	    <p>Duis autem vel eum iriure dolor in hendrerit in vulputate
	    velit esse molestie consequat, vel illum dolore eu feugiat
	    nulla facilisis at vero eros et accumsan et iusto odio
	    dignissim qui blandit praesent luptatum zzril delenit augue
	    duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit
	    amet, consectetuer adipiscing elit, sed diam nonummy nibh
	    euismod tincidunt ut laoreet dolore magna aliquam erat
	    volutpat.</p>
	  </div>
	</div>
      </div>
    </body>
  </text>
</TEI>

So let's have a look at this file. This can be brief since most of the tags are described in the TEI guidelines and tutorials.

Every TEI file has as its root level (i.e. the "outer" level of the xml file) the element

<TEI>

</TEI>

which defines it as a TEI xml file. Everything else is a "child" of this root level. At the next level, you see two of these children: on the one hand, the <teiHeader> element. This contains meta-information about your electronic edition: title, author, editor, publication status, source of your edition. There can be much more information here. This is meta-information which will usually not be typeset in your edition.

The other child is the <text> element. This is what will really be in a typeset, printed edition. As you see, this has again two children: the <front>, which contains the title of the work you edit in the form in which it will appear in your typeset document, prefatory material, etc. The <body> element contains the text itself. This text has a logical structure: It consists of books, chapters, and sections. All of these logical parts are expressed via different

elements; to distinguish them from each other, these
elements have so-called attributes, so we have:
      <div xml:id="VS1" n="I" type="book">
	<div xml:id="VS1p" n="praef" type="chapter">
	  <div xml:id="VS1p1" n="1" type="section">
          </div>
        </div>
     </div>
As you can see, most of these
elements have other attributes as well: the "xml:id" attribute gives every section in your document a unique identifier. This makes it easier if you want to refer to these sections later. You are free to choose these attributes; as an example, I have opted for a short numeric tag that refers to the paragraph. The "n" attribute is the name of the section as it will appear in your typeset edition. For classical prose texts, it is customary to have the chapter and section numbers appear in the margin of the edition, with no prefix and no additional information about the structure. E.g., at the beginning of chapter 8, there will be bold 8 in the margin (the mark for "section 1" is understood and usually not expressed). For subsequent sections of chapter 8, there will be smaller section numbers in the margin, like "2," "3," etc. Finally, such sections of chapters do not necessarily begin a new paragraph. In order to make this clear, I have used the "rend" attribute (not exactly in the way TEI defines it, but close enough). For sections, I have two types of "rend" attributes" "inline" means that this section should just continue the typographical paragraph; "paragraph" means that it should be begin in a new paragraph. This is an important distinction which I want to emphasize: in your typeset edition, these two will appear very different. For the logical structure of your digital text, however, they are both on the same level. That's why they are both
of the same type, but with different "rend" attributes.

--Thomas 11:37, 10 October 2010 (UTC)