Search code examples
htmlxsltformattingtei

TEI translation not recognizing <p> tags


I am given a TEI xml spreadsheet and I need to make a layout for it. My biggest problem currently is that the format uses p tags to break up the text. However when I parse the xml to html the tags are not there, instead the spacing is there in the document.

As follows is my model that I'm trying to output, yes it's very lacking right now:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="tei">

<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
     <html xmlns="http://www.w3.org/1999/xhtml">
       <body style="font-family:Arial;font-size:12pt;">
<div style="color:teal;padding:4px; background-color: rgba(255, 255, 255, .8);">
  <span style="font-weight:bold">
    <xsl:value-of select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title"/>
    <p>
      <xsl:value-of select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/>
    </p>
    <xsl:value-of select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt"/>

    <p>
      <xsl:value-of select="tei:TEI/tei:text"/>
    </p>
  </span>

</div>
</body>
</html>
  </xsl:template>
  </xsl:stylesheet>

Here is the xml I'm trying to interpret

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-model href="http://www.tei-.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
    <?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
    <TEI xmlns="http://www.tei-c.org/ns/1.0">
    <teiHeader>
    <fileDesc>
  <titleStmt>
    <title>No. 1301, Genesis 3:9</title>
    <author>Jacob Cushing</author>
  </titleStmt>
  <publicationStmt>
    <p>
      <address>
        <addrLine>Waltham, Massachusetts</addrLine>
      </address>
    </p>
    <p>
      <date>1770-09-14</date>, <date>1770-09-16</date>
    </p>
  </publicationStmt>
  <sourceDesc>
    <p>
      <bibl>
        <ref target="http://oasis.lib.harvard.edu/oasis/deliver/~div00488">bms 488, Andover-Harvard Theological Library, Harvard Divinity School</ref>
      </bibl>
    </p>
  </sourceDesc>
</fileDesc>
<encodingDesc>
  <refsDecl xml:id="biblical">
    <p>for scriptural citations</p>
    <cRefPattern
       matchPattern="(.+) (.+):(.+)"
       replacementPattern="#xpath(//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="#xpath(//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="#xpath(//div[@n='$1'])">
      <p>
        This pointer pattern extracts and references just the <q>book</q>
        part of a biblical reference.
      </p>
    </cRefPattern>
  </refsDecl>
</encodingDesc>
    </teiHeader>
    <text>
    <body>
    <p>
    <quote cRef="Genesis 3:9">
      And the Lord called unto <name type="m" role="biblical">Adam</name>, &amp; said
      unto him, where art thou?
    </quote>
  </p>
  <p>
    That we may, in some good Degree, have
    our Hearts affected with redeeming Love, &amp; the
    Salvation brought us by ye <choice>
      <orig>2d</orig>
      <reg>second</reg>
    </choice> <name type="m" role="biblical">Adam</name>, it may not
    be improper to take a View of our Misery
    by ye first, for which I have chosen these words&#x2014;
  </p>

  <p>
    We have here ye Voice of Mans Creator and
    Judge, making Inquisition after his Creature
    now lost &amp; by his early Disobedience fallen
    from him.
  </p>

  <p>
    God made Man upright, after his own
    Image; but being in Honor, thro' forgetting his Maker,
    he continued not, but fell from his Obedienced
    &amp; Glory, into a Vileness like that of the
    Beasts that perish.
  </p>

  <p>
    Our first parents hearkening to ye Temptation
    of ye Devil &amp; braking thro' ye divine Law by eating
    of ye forbidden fruit, soon experienced a sad
    Change in themselves. And as soon as they
    discovered it, like guilty Criminals, they attempted
    to fly from Justice.
  </p>

  <p>
    Their great Creator coming into paradise
    after ye apostasy, &amp; finding his Creatures fled,
    avoiding his presence &amp; hiding themselves among
    the Trees, he calls to one of them in these words
    of ye Text, <quote cRef="Genesis 3:9">
      "<name type="m" role="biblical">Adam</name>, where art thou?"
    </quote> which words
    may be considered&#x2014;
  </p>

  <p>
    1. As an Expression of Admiration, i.e. How
    great &amp; sudden a Change! Where! whither is
    <pb n="2"></pb> The Creature gone, which I so lately made &amp; dearly
    loved; with whom I was so well pleased, &amp; took so
    much delight; who lately above all Things desired my
    Company, &amp; rejoiced in it, placing his Life in
    my favor &amp; Love? What a strange Turn is made?
    &amp; from whence can it proceed? Is man afraid
    of his God that he thus runs from him? Is he impatient
    of my presence, weary of my Converse,
    unwilling of further Acquaintance with me, that he
    now retires at my Approach &amp; seems to hide?
    He was not wont do do so. <quote cRef="Genesis 3:9">
      "<name type="m" role="biblical">Adam</name>, where art thou?"
    </quote>
  </p>


</body>
    </text>
    </TEI>

This is the translated html. You can see where the p tags used to be but are now large spaces:

    <?xml version="1.0" encoding="utf-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml">
     <body style="font-family:Arial;font-size:12pt;">
        <div style="color:teal;padding:4px; background-color: rgba(255, 255, 255, .8);">
           <span style="font-weight:bold">No. 1301, Genesis 3:9<p>Jacob Cushing</p>


        Waltham, Massachusetts



      1770-09-14, 1770-09-16

  <p>



      And the Lord called unto Adam, &amp; said
      unto him, where art thou?



    That we may, in some good Degree, have
    our Hearts affected with redeeming Love, &amp; the
    Salvation brought us by ye 
      2d
      second
     Adam, it may not
    be improper to take a View of our Misery
    by ye first, for which I have chosen these words—



    We have here ye Voice of Mans Creator and
    Judge, making Inquisition after his Creature
    now lost &amp; by his early Disobedience fallen
    from him.



    God made Man upright, after his own
    Image; but being in Honor, thro' forgetting his Maker,
    he continued not, but fell from his Obedienced
    &amp; Glory, into a Vileness like that of the
    Beasts that perish.
        </p></span>
       </div>
      </body>
    </html>

Desired Output but I'd also love to be able to identify all the quote, orig, reg, and name tags:

     <?xml version="1.0" encoding="utf-8"?>
     <html xmlns="http://www.w3.org/1999/xhtml">
      <body style="font-family:Arial;font-size:12pt;">
        <div style="color:teal;padding:4px; background-color: rgba(255, 255, 255, .8);">
           <span style="font-weight:bold">No. 1301, Genesis 3:9<p>Jacob Cushing</p>

      <p>
        Waltham, Massachusetts
      </p>

    <p>
      1770-09-14, 1770-09-16
    </p>
  <p>


    <p>
      And the Lord called unto Adam, &amp; said
      unto him, where art thou?
    </p>

  <p>
    That we may, in some good Degree, have
    our Hearts affected with redeeming Love, &amp; the
    Salvation brought us by ye 
      2d
      second
     Adam, it may not
    be improper to take a View of our Misery
    by ye first, for which I have chosen these words—
  </p>

  <p>
    We have here ye Voice of Mans Creator and
    Judge, making Inquisition after his Creature
    now lost &amp; by his early Disobedience fallen
    from him.
  </p>

  <p>
    God made Man upright, after his own
    Image; but being in Honor, thro' forgetting his Maker,
    he continued not, but fell from his Obedienced
    &amp; Glory, into a Vileness like that of the
    Beasts that perish.
   </p>
        </p></span>
       </div>
      </body>
    </html>

I really need some help here. Also if you know of a good tutorial or documentation for the interpretation of TEI I'd greatly appreciate it!


Solution

  • So @C. M. Sperberg-McQueen thanks! I just needed to add this to my code for the paragraphs to show up with their correct values and still be in block style:

     <xsl:template match="tei:text/tei:body/tei:p">
        <p xmlns="http://www.w3.org/1999/xhtml">
          <xsl:value-of select="."/>
        </p>
      </xsl:template>