TEI翻译无法识别<p>标签</p>

时间:2015-03-30 13:09:03

标签: html xslt formatting tei

我获得了一个TEI xml电子表格,我需要为它制作一个布局。我目前最大的问题是该格式使用p标签来分解文本。但是,当我将xml解析为html时,标签不存在,而是文档中存在间距。

以下是我正在尝试输出的模型,是的,现在非常缺乏:

<?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>

这是我试图解释的xml

    <?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>

这是翻译过的html。您可以看到p标签的位置,但现在是大空格:

    <?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>

期望输出,但我也希望能够识别所有引号,orig,注册和名称标签:

     <?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>

我真的需要一些帮助。此外,如果你知道一个很好的教程或文档解释TEI我会非常感谢!

1 个答案:

答案 0 :(得分:0)

所以@C。 M. Sperberg-McQueen谢谢!我只需要将其添加到我的代码中,以便段落显示正确的值并仍然采用块样式:

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