Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml TEI临界装置,双端点连接;如何处理XSL生成HTML_Xml_Xslt_Overlapping - Fatal编程技术网

Xml TEI临界装置,双端点连接;如何处理XSL生成HTML

Xml TEI临界装置,双端点连接;如何处理XSL生成HTML,xml,xslt,overlapping,Xml,Xslt,Overlapping,我必须处理以下XML结构: <p>[1] Intencio <emph rend="italic">nostra</emph> <anchor xml:id="AJH-L.1.1"/>de<anchor xml:id="AJH-L.1.2"/> some more like this.. </p> <app from="#AJH-L.1.1" to="#AJH-L.1.2"> <rdg wit="#

我必须处理以下XML结构:

<p>[1] Intencio <emph rend="italic">nostra</emph>
  <anchor xml:id="AJH-L.1.1"/>de<anchor xml:id="AJH-L.1.2"/> some more like this..
</p>
<app from="#AJH-L.1.1" to="#AJH-L.1.2">
  <rdg wit="#V">in</rdg>
</app>
变成类似于:

<div>[1] Intencio <span class='italic'>nostra</span>
  de<a href='AJH-L.1.1'>1</a> and so on..
</div>
<div class='appEntry'>
  <span class='rdg'>in</span>
</div>
而1是上标

我在构建实际的apparat时没有问题,但是在构建脚注时,因为有关锚的信息来自外部apparat元素

除此之外,我必须提到的是,可以同时从anchor-1到anchor-4添加一个应用程序元素

我在这里看到了一个关于如何在这些伪重叠元素之间选择文本的问题,它对我帮助很大。但是我找不到解决这个问题的办法

在TEI中必须有这样一个标准方法的解决方案,但我找不到,如果有人有任何建议,我将非常高兴

多谢各位,
Timo

这里是一个更复杂的XML示例,其中也包括重叠问题

<div type='subdivision'>
  <p>
    ....
     <anchor xml:id="AJH-L.2.63"/>intellectus cum re que sentitur <anchor
     xml:id="AJH-L.2.64"/>in<anchor xml:id="AJH-L.2.65"/> apprehensione<anchor
     xml:id="AJH-L.2.66"/>
    ....
  </p>
  ....
  <app from="#AJH-L.2.64" to="#AJH-L.2.65">
    <rdg wit="#H #M #N #P #R #V">-</rdg>
  </app>
  <app from="#AJH-L.2.63" to="#AJH-L.2.66">
    <rdg wit="#M">- <emph rend="italic">hom.</emph></rdg>
  </app>
  ....
</div>
到目前为止,我的XSLT模板:

    <xsl:template match="TEI:anchor">
      <xsl:variable select="@xml:id" name="anchorId"/>
      <xsl:for-each select="ancestor::TEI:p/TEI:app[@to=concat('#',$anchorId)]">
        <a class="rs" name="rs_{count(preceding::TEI:app)+1}"
          href="#app_{count(preceding::TEI:app)+1}">
          <xsl:value-of select="count(preceding::TEI:app)+1"/>
        </a>
      </xsl:for-each>
    </xsl:template>

    <xsl:template match="TEI:app">
    <xsl:variable select="substring(@from,2)" name="from"/>
    <xsl:variable select="substring(@to,2)" name="to"/>
    <table class="appEntry">
      <tr rowspan="{count(TEI:rdg)+1}">
        <td>
          <a name="app_{position()}" href="#rs_{position()}">
            <xsl:value-of select="position()"/>
          </a>
        </td>
        <td>
        <!-- the referenced text from between the anchors -->
           <xsl:value-of select="//TEI:div[current()]//text()[preceding::TEI:anchor[@xml:id=$from] and following::TEI:anchor[@xml:id=$to]]"/>
          <xsl:for-each select="TEI:rdg">
            <tr>
              <td>
                <!-- all readings -->
                <xsl:value-of select="."/>
              </td>
            </tr>
          </xsl:for-each>
        </td>
      </tr>
    </table>
  </xsl:template>
结果输出应如下所示:

<div class="maintext">
  ....
  intellectus cum re que sentitur in <a href="#app_32" name="rs_32" class="rs">32</a>
  apprehensione <a href="#app_33" name="rs_33" class="rs">33</a>
  ....
</div>
<div class="apparatus">
  ....
  <tr>
    <td><a href="#rs_32" name="app_32">32</a><td>
    <td>in</td>
    <td> - </td>
  </tr>
  <tr>
    <td><a href="#rs_33" name="app_33">33</a><td>
    <td>intellectus cum re que sentitur </td>
    <td>- hom.</td>
    </tr>
  ....
</div>
除了乱七八糟的桌子之外,这似乎还不错。一旦我有了正确的开始,那就不是我想象中的巫毒

我希望,我能详细说明我的问题并给出一个好的答案。 你觉得怎么样

您好,
蒂莫

你有一个好问题的开始,但我发现很难理解。您能提供到目前为止已经尝试过的XSL吗?另外,我不明白你所说的可以同时从anchor-1到anchor-4添加一个应用元素是什么意思-你能举个例子吗?@cordsen:好吧,现在我知道我不是唯一一个对此感到困惑的人:sry。实际上我已经走上了一条很好的道路。明天我会给你看我自己的解决方案,否则就制造更多的混乱