【问题标题】:Cross-reference between two xml tei files两个 xml tei 文件之间的交叉引用
【发布时间】:2015-05-12 15:16:14
【问题描述】:

我有第一个这样的 XML TEI 文件:

<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader xml:lang="en" />
  <text>
    <body>
      <div type="chapter" n="1">
        <p>
          <s xml:id="e_1">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</s>
        </p>
        <p>
          <s xml:id="e_2">"Whenever you feel like criticizing any one," he told me, "just remember that all the people in this world haven't had the advantages that you've had."</s>
        </p>
      </div>
      <div type="chapter" n="2">
        <p>
          <s xml:id="e_3">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</s>
        </p>
        <p>
          <s xml:id="e_4">"Whenever you feel like criticizing any one," he told me, "just remember that all the people in this world haven't had the advantages that you've had."</s>
        </p>
      </div>
    </body>
  </text>
</TEI>

然后,我有第二个这样的 XML TEI 文件:

 <?xml version="1.0" encoding="UTF-8"?>
    <TEI xmlns="http://www.tei-c.org/ns/1.0">
      <teiHeader xml:lang="en" />
      <text>
        <body>
          <div type="chapter" n="1">
            <p>
              <s xml:id="f_1">explanation of the sentence e_1.</s>
            </p>
            <p>
              <s xml:id="f_2">explanation of the sentence e_2</s>
            </p>
           </div>
           <div type="chapter" n="2">
            <p>
              <s xml:id="f_3">explanation of the sentence e_1.</s>
            </p>
            <p>
              <s xml:id="f_4">explanation of the sentence e_2</s>
            </p>
           </div>
        </body>
      </text>
    </TEI>

第二个文件包含对第一个文件的一些解释。我想知道是否可以在这两个文件之间进行交叉引用?在 XML 中执行此操作的常用/最佳方法是什么? TEI 有什么特别之处吗?

【问题讨论】:

  • 什么编程语言?您的样本没有结束
    标记,因此它无效。我假设您只发布了实际文件的一部分。我会使用“使用 'div' 和 'chapter' 编号加入。如果您发布包含多个
    的更大样本,我会有所帮助。
  • @jdweng 我已经更正了 xml 示例。该文件是重复的,我已经制作了第二个 div 。 PHP 会很棒。
  • 我不是 PHP 人。通常在 C# 中执行此操作。我会在您的请求中为 PHP 添加一个额外的标签。

标签: xml cross-reference tei


【解决方案1】:

第二个文件包含对第一个文件的一些解释。我想知道是否可以在这两个文件之间进行交叉引用?在 XML 中执行此操作的常用/最佳方法是什么? TEI 有什么特别之处吗?

是的,在 TEI 中有一种特定的方法可以做到这一点——只需使用 tei:link-element。见:https://tei-c.org/release/doc/tei-p5-doc/en/html/ref-link.html

在我自己的项目中,我使用了一个单独的文件,它充当一种索引并链接多个文档。在处理过程中(例如通过 XSLT 或 XQuery),链接用于所需的行为(例如 HTML 锚标记)。

【讨论】:

    猜你喜欢
    • 2016-03-13
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多