2017-12-27 1206 views
0

我有哪些內容用於XSLT第一TEI,你可以在這裏找到http://xsltfiddle.liberty-development.net/3Nqn5Y4/7的xsl:檢查,如果兩個字符串是相等的,如果爲true,則顯示另一個字符串

corpus_ilimilku.xml第二TEI,我需要在使用相同XSLT文件:

<category n="1" xml:id="contend" ana="#verb.competition"> 
    <catDesc xml:lang="en">subcategory of competition verb: contend 
     <lang> 
      <ref n="1" target="http://babelnet.org">BabelNet<idno type="URI">http://live.babelnet.org/synset?word=bn:00083498v</idno></ref> 
      <ref n="2" target="https://framenet2.icsi.berkeley.edu/">FrameNet<idno type="URI">https://framenet2.icsi.berkeley.edu/fnReports/data/frameIndex.xml?frame=Attaching"></idno></ref> 
     </lang> 
     </catDesc> 
     <category ana="#transcription" xml:lang="uga"> 
      <gloss n="1" xml:id="ḫṣb01" target="../uga/verb.xsl#ḫṣb"/> 
      <gloss n="2" xml:id="mḫṣ01" cert="high" target="../uga/verb.xsl#mḫṣ"/> 
     </category> 
</category> 

我沒有問題來引用正確的文件。我檢查過了,它正在工作。

其實,我有兩個問題:

  1. refkey不工作,我認爲,
  2. 所以當我想要顯示的$value-doc2href5如果"$value-doc = translate($re-ana2, '#', '')是真實的,我有以下消息:

描述:多個項目的序列不允許作爲標記化的()中的第一個參數(「」 http://live.babelnet.org/synse ... 「」 https://framenet2.icsi.berkeley.edu ...「)

目前,"$value-doc = translate($re-ana2, '#', '')的作品,因爲我有幾個值進行測試,其結果是truefalse。看到每個<li>print screen for <code>$check-id</code>

最後一個字,我想什麼來顯示:

<h3>mḫṣ</h3><em> 
mean.: </em>to figth, to destroy. Inflected forms attested: 
<ul> 
<li>tmtḫṣ: gram. → Gt. ind. imperf. trans, 2msg, 3fsg. <em>trans. </em>she fought -- remark(s): iterative function // with 「<a href="../computation/corpus_ilimilku.xml#ktu1-3_ii_l6b_t%E1%B8%ABt%E1%B9%A3b">tḫtṣb</a>.」 Occur.: <a href="">ktu1.3:ii:l5b-6a</a> -- <em>analysis: </em>suggestion of 
    <a href="../computation/corpus_ilimilku.xml#ktu1-3_ii_l5b_6a_int">hermeneutics;</a> taxo., subcat. of competition v. 「<a href="../computation/corpus_ilimilku.xml#m%E1%B8%AB%E1%B9%A301">contend</a>.」 
    <!-- DATA THAT I CANNOT DISPLAY : --> <a href="http://live.babelnet.org/synset?word=bn:00083498v">BabelNet</a>, <a href="https://framenet2.icsi.berkeley.edu/fnReports/data/frameIndex.xml?frame=Attaching">Framework</a> 
    </li> 
    <li>tmḫṣ: gram. → D. ind. perf. trans, 2msg, 3fsg. <em>trans. </em>she destroyed -- remark(s): 
    Occur.: <a href="">ktu1.3:ii:l7</a> -- <em>analysis: </em>suggestion of <a href="../computation/corpus_ilimilku.xml#ktu1-3_ii_l7_int">hermeneutics;</a> taxo., subcat. of emotion's v. as a concept of 「<a href="../computation/corpus_ilimilku.xml#m%E1%B8%AB%E1%B9%A302">humiliation</a>.」 
    <!-- DATA THAT I CANNOT DISPLAY : --> <a href="http://live.babelnet.org/synset?word=bn:00083498v">BabelNet</a>, <a href="https://framenet2.icsi.berkeley.edu/fnReports/data/frameIndex.xml?frame=Attaching">Framework</a> 
</li> 
</ul> 

綜上所述:如果第二TEIcorpus_ilimilku.xml<gloss>@xml:id =電流TEI<re>@ana[2](在小提琴內容),然後顯示屬於gloss的相同父節點的每個refidno @type URI

我希望我的解釋清楚。對不起,我缺少英語......

提前,謝謝。

+0

正確答案在下面。 – Vanessa

回答

0

我在@Martin的支持下找到了解決方案。首先,我改變第二TEI

<category n="1" xml:id="humiliation" ana="#verb.emotion"> 
    <catDesc >subcategory of emotion's verb as a concept of: humiliation 
     <term ana="#mḫṣ02 #ṣmt01" type="baseForm"> 
      <ptr n="1" target="http://babelnet.org/synset?word=bn:00086117v" source="BabelNet" /> 
      <ptr n="2" target="" source="WordNet" next="{01804206}" /> 
      <ptr n="3" target="http://verbs.colorado.edu/propbank/framesets-english-aliases/humiliate.html" source="VerbNet" /> 
      <ptr n="4" target="http://verbs.colorado.edu/html_groupings/wound-n.html" source="VerbNet" /> 
      <ptr n="5" target="https://framenet2.icsi.berkeley.edu/fnReports/data/frameIndex.xml?frame=Stimulate_emotion" source="FrameNet" /> 
     </term> 
     </catDesc> 
     <category ana="#verb.emotion #humiliation" xml:lang="uga"> 
      <gloss n="1" xml:id="mḫṣ02" cert="high"/> 
     </category> 
    </category> 

然後對於XSL,下列加法:

<xsl:param name="f2" select="'../computation/corpus_ilimilku.xml'"/> 

<!-- key to look for @xml:id of <gloss> within TEI --> 
<xsl:key name="gloss-ref" match="category[category/gloss]" use="category/gloss/@xml:id"/> 
<!-- variable for "f2" --> 
<xsl:variable name="doc2" select="document($f2)"/> 

<!-- within template match="entryFree" and <ul><li> --> 
<xsl:apply-templates select="key('gloss-ref', translate($re-ana2, '#', ''), $doc2)//term/ptr[@target]"/> 

<!-- template to display <xsl:apply-templates> --> 
<xsl:template match="ptr"> 
    <xsl:variable name="href-ptr-target" select="@target"/> 
    <a href="{$href-ptr-target}"> 
    <xsl:value-of select="@source"/> 
    <xsl:if test="@next"> 
     <xsl:value-of select="@next"/> 
    </xsl:if> 
    <xsl:choose> <xsl:when test="position() != last()"> 
     <xsl:text>, </xsl:text> </xsl:when> 
     <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise> 
    </xsl:choose></a> 
</xsl:template> 

結果,根據小提琴http://xsltfiddle.liberty-development.net/3Nqn5Y4/9,新XSL(之間<!-- -->在小提琴),和第二TEI內容:

<ul> 
    <li>tmḫṣ: gram. → D. ind. perf. trans, 2msg, 3fsg. <em>trans. </em>she destroyed -- remark(s): Occur.: <a href="">ktu1.3:ii:l7</a> -- <em>analysis: </em>suggestion of <a href="../computation/corpus_ilimilku.xml#ktu1-3_ii_l7_int">hermeneutics;</a> taxo., subcat. of emotion's v. as a concept of 「<a href="../computation/corpus_ilimilku.xml#m%E1%B8%AB%E1%B9%A302">humiliation</a>.」 Related to: <a href="http://babelnet.org/synset?word=bn:00086117v">BabelNet, </a><a href="">WordNet{01804206}, </a><a href="http://verbs.colorado.edu/propbank/framesets-english-aliases/humiliate.html">VerbNet, </a><a href="http://verbs.colorado.edu/html_groupings/wound-n.html">VerbNet, </a><a href="https://framenet2.icsi.berkeley.edu/fnReports/data/frameIndex.xml?frame=Stimulate_emotion">FrameNet.</a></li> 
</ul> 
2

如果線路

<!-- DATA THAT I CANNOT DISPLAY : --> <a href="http://live.babelnet.org/synset?word=bn:00083498v">BabelNet</a>, <a href="https://framenet2.icsi.berkeley.edu/fnReports/data/frameIndex.xml?frame=Attaching">Framework</a> 

是爲了說明您要變換的

document('../computation/corpus_ilimilku.xml')//lang/ref/idno 

元素融入鏈接然後要創建這些鏈接中使用

<xsl:apply-templates select="document('../computation/corpus_ilimilku.xml')//lang/ref/idno"/> 

然後寫一個模板

<xsl:template match="idno"> 
    <a href="{.}"> 
    <xsl:value-of select="preceding-sibling::node()[1]"/> 
    </a> 
</xsl:template> 

產生這些鏈接(我不太確定鏈接的內容,第一個BabelNet看起來如上所述,第二個是FrameNetFramework)。

至於使用按鍵與幾個文件,鑰匙在每個文件的基礎工作和key函數可以指定從如上下文文件與價值觀搜索e.g $doc2一個可選的第三個參數key('key-name', (key-value-or-values), $doc2)

我想你的口頭描述

如果@xml:第二TEI(corpus_ilimilku.xml)的ID = @ana [2]的電流TEI(在小提琴含量) ,然後顯示IDNO @鍵入屬於光澤

的相同父節點的每個參考文獻的URI 轉換成一個密鑰聲明

<xsl:key name="gloss-ref" match="category[category/gloss]" use="category/gloss/@xml:id"/> 

然後讓我們假設我們有一個全局變量<xsl:variable name="doc2" select="doc('../computation/corpus_ilimilku.xml')"/>我認爲你想要在例如

<xsl:apply-templates select="key('gloss-ref', $re-ana2, $doc2)//lang/ref/idno"/> 

處理相關的idno元素。

+0

謝謝@Martin!我想我現在理解'apply-templates'。關於'key',我現在做了:''(其中'$ idno-ref'代表' document('../modulation/corpus_ilimilku.xml')// lang/ref/idno'),但是我爲每個字符串'$ check-id = true()'擁有文檔的所有'idno'。我錯了什麼? – Vanessa

+0

我也嘗試過'xsl:for-each'而不是'xsl:if'繼[鏈接]的最後一個答案之後(https://stackoverflow.com/questions/1620527/how-do-i-apply-templates-每個選擇節點在每個節點),但它再次不起作用。 – Vanessa

+1

爲什麼'key('ref',@n和@type ...)'爲鍵值使用布爾表達式@n和@ type'? –

相關問題