Tei:p

tei:p (paragraph) "marks paragraphs in prose" (http://www.tei-c.org/P4X/ref-P.html). For a discussion of how to encode paragraphs in a variety of structural languages, see Paragraph (part of the how do I encode...  Binder).

Subclasses and attributes
There are no required attributes or subclasses. or  may be used to distinguish among different types of paragraphs, e.g.

rend="first" rend="warning"

See the TEI Guidelines for a discussion of available attributes.

Style
Paragraphs may be formatted in a variety of different ways depending on the conventions of the medium and aesthetic sensibility of the text designer. Some common formattings include:


 * Block style (justified on one or both sides; first line not indented; 1 line space above and below). This is a common display for text on screen)
 * Indented style (justified on one or both sides; first line indented slightly; no leading or trailing space). This is common in print contexts.
 * Hanging first line (justified on one or both sides; first line extended slightly into the left-margin; with or without no leading or trailing space). This is common in bibliographies.

CSS
If you are attempting to display a TEI XML document directly in a commercial browser, the following CSS fragments can be used to style the element:

Block style
p { display:block; margin-top:1em; margin-bottom:1em; }

Indented style
p { display:block; margin-top:0; margin-bottom:0; text-indent:1em; }

Hanging first line
p { display:block; margin-top:0; margin-bottom:0; text-indent:-1em; }

Justified left and right margins
All three of the above fragments will produce right-justified text (i.e. aligned down the left margin [except for the first line, in the Indented style] with a "ragged" right margin). To justify both margins, you can add the following line to any style:

text-align:justify;

Conversion to XHTML
If you are going to convert your TEI paragraph to XHTML, the basic template looks like this

&lt;xsl:template match="p"&gt; &lt;p&gt;&lt;xsl:apply-templates/&gt;&lt;/p&gt; &lt;/xsl:template&gt;

As noted in the Paragraph article, however, TEI and (X)HTML have a different model for paragraphs. This becomes an issue with typographically complex paragraphs, particularly those containing internal block quotations, tables, lists, or figures. The specific details of the template used to do this will vary depending on the precise coding of the input XML document. The following example is based on the markup used for articles in the DM journal, where block quotes are encoded as follows (Lorem ipsum from the Lorem ipsum generator):

&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam id lorem. Nulla velit dolor, pulvinar id, dignissim et, lobortis et, eros. Quisque pretium turpis luctus dui. Praesent dapibus. Nunc tincidunt orci eu arcu. &lt;quote&gt; &lt;p&gt;Curabitur mollis, magna eu ultricies sagittis, justo mi commodo tellus, sit amet aliquam pede dui sed nunc. Aenean at eros. Aenean eu quam vel massa laoreet suscipit.&lt;/p&gt; &lt;/quote&gt; Nunc arcu quam, congue ac, congue et, ullamcorper a, leo. Maecenas dapibus, sapien non semper semper, neque enim dapibus ligula, in cursus quam dolor sed nunc. Nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&lt;/p&gt;

Converting this to valid XHTML requires the following the XSLT (version 2.0):

&lt;xsl:template match="p"&gt; &lt;xsl:for-each-group select="node" group-adjacent="self::quote[p] or self::table or self::list"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="current-grouping-key"&gt; &lt;xsl:apply-templates select="current-group"/&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;p&gt; &lt;xsl:copy-of select="current-group"/&gt; &lt;/p&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:for-each-group&gt; &lt;/xsl:template&gt;

(Based on the example Grouping Alternating Sequences of Elements in the XSLT 2.0 Specification).

Resources
The differences between the TEI and XHTML models for paragraph were the subject of an extended discussion on TEI-L, the mailing list of the Text Encoding initiative. To follow the thread, begin with: http://listserv.brown.edu/archives/cgi-bin/wa?A2=ind0501&amp;L=tei-l&amp;F=&amp;S=&amp;P=20212.

The XSLT method proposed here requires XSLT 2.0. A partial solution for XSLT 1.0 was posted by Michael Beddow as part of the tei-l thread: http://listserv.brown.edu/archives/cgi-bin/wa?A2=ind0501&amp;L=tei-l&amp;F=&amp;S=&amp;P=24080.

Related topics

 * How do I encode...
 * Paragraph