1
我有一段通過xquery生成的XML,我試圖將xsl樣式表應用到它。我知道樣式表適用於我用來構建查詢的xml文件,但我不確定爲什麼它不能與我生成的xml一起使用:xsl模板的奇怪行爲
我在源文檔之一中擁有以下一片xml文件:
<zone n="EETS.QD.4">
<line n="l.1">
<orig><hi>O</hi> alle ye <gap quantity="8" unit="chars" reason="illegible"
/>s of ierusaleem<note place="bottom" anchored="true"
xml:id="explanatory">The 「l」 in 「ierusaleem」 in the final word is
determined from context.</note></orig>
</line>
在XQuery生成的文件,這是與其他文件結合線得到以下:
<list xml:id="compare">
<item>
<orig>London, British Library Harley 2251: <ref target=".html">O alle ye doughtres · of Jerusalem</ref>
</orig>
</item>
<item>
<orig>London, British Library Harley 2255: <ref target=".html">
<hi rend="blue_pilcrow">¶</hi>O alle ye douħtren of <hi rend="underline">ierusaleem</hi>
</ref>
</orig>
</item>
<item>
<orig>Long Melford, Holy Trinity Church Clopton Chantry Chapel: <ref target=".html">
<hi>O</hi> alle ye <gap quantity="8" unit="chars" reason="illegible"/>s of ierusaleem<note place="bottom" anchored="true" xml:id="explanatory">The 「l」 in 「ierusaleem」 in the final word is
determined from context.</note>
</ref>
</orig>
</item>
<item>
<orig>Cambridge, Jesus College Q.G.8: <ref target=".html">
<hi>A</hi>ll the <hi rend="underline">doughtren </hi>of <hi rend="underline">Ierusalem</hi> .</ref>
</orig>
</item>
<item>
<orig>Oxford, Bodleian Library Laud 683: <ref target=".html">O alle ẏe douhtren of jerusaleem</ref>
</orig>
</item>
</list>
在這兩種情況下,下面的模板應用:
<xsl:template match="tei:orig/tei:gap">
<xsl:text>[</xsl:text>
<xsl:variable name="max" select="@quantity"/>
<xsl:for-each select="1 to $max">
<xsl:text>.</xsl:text>
</xsl:for-each>
<xsl:text>]</xsl:text>
</xsl:template>
在標準的文件,它會顯示什麼,我想正確:
O alle ye [........]s of ierusaleem
但是當應用到生成的文檔,我得到如下:
O alle ye s of ierusaleem
很明顯,它沒有找到子節點,但我不確定爲什麼自從模板在orig標籤中工作。
我遇到的第二個問題是我無法通過xquery或xslt獲取note元素來抑制,但是我懷疑它與這個間隙問題有關。任何意見將不勝感激,謝謝!
在XQuery生成的doc中,'gap'不是'orig'的子元素;這是'ref'的孩子。 –
我沒有看到任何'gap'元素...... –
就是這樣。我覺得自己沒有抓住那個白癡。謝謝邁克爾! – medievalmatt