Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.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
使用tei进行xml层次结构/xsl处理:注意_Xml_Xslt_Xslt 2.0_Tei - Fatal编程技术网

使用tei进行xml层次结构/xsl处理:注意

使用tei进行xml层次结构/xsl处理:注意,xml,xslt,xslt-2.0,tei,Xml,Xslt,Xslt 2.0,Tei,我有我所希望的只是我无知的一个症状,而不是一个不可能解决的问题,但我无法用我的生命让它发挥作用 我使用TEI XML名称空间整理脚注,相关数据打包如下: <surface xml:id="EETS.T.29"> <label>Verse 29</label> <graphic url="/Images/IMG_0479.JPG"/> <zone>

我有我所希望的只是我无知的一个症状,而不是一个不可能解决的问题,但我无法用我的生命让它发挥作用

我使用TEI XML名称空间整理脚注,相关数据打包如下:

<surface xml:id="EETS.T.29">
            <label>Verse 29</label>
            <graphic url="/Images/IMG_0479.JPG"/>
            <zone>
                <line>
                    <orig><hi>N</hi>ow in <damage>th</damage>e name of oure lord ihesus</orig>
                </line>
                <line>
                    <orig>of right hool herte <ex>&amp;</ex> in our<ex>e</ex>
                        <note place="bottom" anchored="true" xml:id="explanatory">Although “r” on the
                        painted panels of the chapel is consistently written with an otiose mark
                        when it concludes a word, the mark here is rendered more heavily and
                        with a dot indicating suspension above the r. This rendering as “oure”
                        is a linguistic outlier for the area based on the electronic <emph
                        rend="italic">Linguistic Atlas of Late Medieval English</emph>’s
                        linguistic profiles for “oure,” “our,” and “oure.” See eLALME's <ref
                        target="http://archive.ling.ed.ac.uk/ihd/elalme_scripts/mapping/user-defined_maps.html"
                        >User Defined Maps</ref> for more information. Unfortunately the current
                        online version does not allow direct linking between static dotmaps and
                        linguistic profiles.</note> best entent</orig>
                </line>
                <line>
                    <orig>our<ex>e</ex> lyf reme<ex>m</ex>bryng froward and vicious</orig>
                </line>
                <line>
                    <orig>ay contrarye to the comaundement</orig>
                </line>
                <line>
                    <orig>of crist ih<ex>es</ex>u now wyth avisement</orig>
                </line>
                <line>
                    <orig>the lord beseching <gap quantity="2" unit="chars" reason="illegible"
                        /><note place="bottom" anchored="true" xml:id="informational">Trapp
                        suggests "of" here, which fits the space in a way that MacCracken's "in
                        thyn" will not, but it does not seem to fit the admittedly paltry
                        remnants of the text. "In" seems the likely word here, but the text is
                        too damaged to definitively state that this is the case.</note>
                        <damage>mercy and pete</damage></orig>
                </line>
                <line>
                    <orig>our<ex>e</ex> youthe <ex>&amp;</ex> age that we have
                        <damage>myspent</damage></orig>
                </line>
                <line>
                    <orig>wyt<damage>h t</damage>h<damage>is woor</damage>d <damage>mercy
                        knelyng</damage> on oure kne<note place="bottom" anchored="true"
                        xml:id="informational">This change occurs only in the Clopton
                        verses.</note></orig>
                </line>
            </zone>
        </surface>
<div class="note"><span class="noteLabel" id="fn1">1.</span>
    <div class="noteBody">Although "r" on the
      painted panels of the chapel is consistently written with an otiose mark
      when it concludes a word, the mark here is rendered more heavily and
      with a dot indicating suspension above the r. This rendering as "oure"
      is a linguistic outlier for the area based on the electronic Linguistic Atlas of Late Medieval English's
      linguistic profiles for "oure," "our," and "oure." See eLALME's User Defined Maps for more information. Unfortunately the current
      online version does not allow direct linking between static dotmaps and
      linguistic profiles.</div>
  </div>
  <div class="note"><span class="noteLabel" id="fn1">1.</span>
    <div class="noteBody">Trapp
      suggests "of" here, which fits the space in a way that MacCracken's "in
      thyn" will not, but it does not seem to fit the admittedly paltry
      remnants of the text. "In" seems the likely word here, but the text is
      too damaged to definitively state that this is the case.</div>
  </div>
  <div class="note"><span class="noteLabel" id="fn1">1.</span>
    <div class="noteBody">This change occurs only in the Clopton
      verses.</div>
  </div>
我需要结果表明的是:

<div class="note"><span class="noteLabel" id="fn1">1.</span>
    <div class="noteBody">Although "r" on the
      painted panels of the chapel is consistently written with an otiose mark
      when it concludes a word, the mark here is rendered more heavily and
      with a dot indicating suspension above the r. This rendering as "oure"
      is a linguistic outlier for the area based on the electronic Linguistic Atlas of Late Medieval English's
      linguistic profiles for "oure," "our," and "oure." See eLALME's User Defined Maps for more information. Unfortunately the current
      online version does not allow direct linking between static dotmaps and
      linguistic profiles.</div>
  </div>
  <div class="note"><span class="noteLabel" id="fn2">2.</span>
    <div class="noteBody">Trapp
      suggests "of" here, which fits the space in a way that MacCracken's "in
      thyn" will not, but it does not seem to fit the admittedly paltry
      remnants of the text. "In" seems the likely word here, but the text is
      too damaged to definitively state that this is the case.</div>
  </div>
  <div class="note"><span class="noteLabel" id="fn3">3.</span>
    <div class="noteBody">This change occurs only in the Clopton
      verses.</div>
  </div>

我认为您所需要的只是一些代码,如下所示,您需要调整模板以匹配名称空间中的元素,但由于您的示例没有显示名称空间,因此我没有使用名称空间:

<xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="yes"/>

<xsl:template match="surface">
  <xsl:apply-templates select=".//orig[note]" mode="list"/>
</xsl:template>

<xsl:template match="orig" mode="list">
<div class ="note"><span class="noteLabel" id="fn{position()}"><xsl:value-of select="position()"></xsl:value-of>.</span><div class="noteBody"><xsl:value-of select="note"/></div></div>
</xsl:template>

</xsl:stylesheet>
将已发布的输入示例转换为结果

<div class="note"><span class="noteLabel" id="fn1">1.</span><div class="noteBody">Although “r” on the
      painted panels of the chapel is consistently written with an otiose mark
      when it concludes a word, the mark here is rendered more heavily and
      with a dot indicating suspension above the r. This rendering as “oure”
      is a linguistic outlier for the area based on the electronic Linguistic Atlas of Late
      Medieval English’s
      linguistic profiles for “oure,” “our,” and “oure.” See eLALME's User Defined Maps
      for more information. Unfortunately the current
      online version does not allow direct linking between static dotmaps and
      linguistic profiles.
   </div>
</div>
<div class="note"><span class="noteLabel" id="fn2">2.</span><div class="noteBody">Trapp
      suggests "of" here, which fits the space in a way that MacCracken's "in
      thyn" will not, but it does not seem to fit the admittedly paltry
      remnants of the text. "In" seems the likely word here, but the text is
      too damaged to definitively state that this is the case.
   </div>
</div>
<div class="note"><span class="noteLabel" id="fn3">3.</span><div class="noteBody">This change occurs only in the Clopton
      verses.
   </div>
</div>

这是我对XSLT部分的建议,如果我理解正确的话。由于目标格式似乎是HTML,我想知道为什么不使用有序列表和列表项来对项目进行编号。

如果需要对相同的节点进行两次处理,XSLT中通常的方法是编写两个模板,以相同的匹配模式匹配节点,并使用mode属性区分它们,然后,以特定模式将节点推送到模板。这是我在阅读你的问题描述时的主要想法。您需要向我们展示如何调用模板makeNote,以及哪个输出循环产生或应该产生,以获得关于如何改进或更改它们的建议。您的问题表明,您目前的主要问题是注释编号为1、1、1,但您希望它们编号为1、1、3。这是正确的吗?我已经编辑了我的文章,以包括我当前和预期的结果,我将研究如何合并模式属性。makeNotes几乎是通过@C.M.Sperberg-McQueen调用的。我真正想要的是他们被编号为1,2,3。其他一切都按我的意愿进行。这有点烦人,因为这是一件很小的事情,你知道吗?如果你想让它们编号为1,2,3,你可能想更正你的帖子中显示你想要的输出的部分,它将它们编号为1,1,3。可能是因为我在xsl中完成了这项工作。不过,这是个好建议。
<xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="yes"/>

<xsl:template match="surface">
  <xsl:apply-templates select=".//orig[note]" mode="list"/>
</xsl:template>

<xsl:template match="orig" mode="list">
<div class ="note"><span class="noteLabel" id="fn{position()}"><xsl:value-of select="position()"></xsl:value-of>.</span><div class="noteBody"><xsl:value-of select="note"/></div></div>
</xsl:template>

</xsl:stylesheet>
<div class="note"><span class="noteLabel" id="fn1">1.</span><div class="noteBody">Although “r” on the
      painted panels of the chapel is consistently written with an otiose mark
      when it concludes a word, the mark here is rendered more heavily and
      with a dot indicating suspension above the r. This rendering as “oure”
      is a linguistic outlier for the area based on the electronic Linguistic Atlas of Late
      Medieval English’s
      linguistic profiles for “oure,” “our,” and “oure.” See eLALME's User Defined Maps
      for more information. Unfortunately the current
      online version does not allow direct linking between static dotmaps and
      linguistic profiles.
   </div>
</div>
<div class="note"><span class="noteLabel" id="fn2">2.</span><div class="noteBody">Trapp
      suggests "of" here, which fits the space in a way that MacCracken's "in
      thyn" will not, but it does not seem to fit the admittedly paltry
      remnants of the text. "In" seems the likely word here, but the text is
      too damaged to definitively state that this is the case.
   </div>
</div>
<div class="note"><span class="noteLabel" id="fn3">3.</span><div class="noteBody">This change occurs only in the Clopton
      verses.
   </div>
</div>