排除<xsl:apply-templates select= />

问题描述 投票:0回答:1

我正在处理这个 TEI XML 文档:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://epidoc.stoa.org/schema/latest/tei-epidoc.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://epidoc.stoa.org/schema/latest/tei-epidoc.rng" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:space="preserve" xml:lang="en">
    <teiHeader>
        <fileDesc>
            <titleStmt>
                <title>Vat. Pal. gr. 44</title>
            </titleStmt>
            <publicationStmt>
                <authority></authority>
                <idno type="filename">colophon.010</idno>
                <idno type="Σημειώματα"><ref target="http://simeiomata-kodikon.arch.uoa.gr/index.php/simeioma/10">10</ref></idno>
                <idno type="nr">10</idno>
            </publicationStmt>
            <sourceDesc>
                <msDesc>
                    <msIdentifier>
                        <settlement ref="#vatican">Città del Vaticano</settlement> 
                        <repository ref="#BAV">Biblioteca Apostolica Vaticana</repository> 
                        <collection>Pal. gr.</collection>
                        <idno>44</idno>
                        <altIdentifier type="Pinakes">
                            <idno><ref target="https://pinakes.irht.cnrs.fr/notices/cote/id/65777">65777</ref></idno>
                        </altIdentifier>
                    </msIdentifier>
                    <physDesc>
                        <objectDesc>
                            <supportDesc>
                                <support xml:lang="it">Manoscritto <material>pergamenaceo</material>.</support>
                            </supportDesc>
                            <layoutDesc>
                                <layout xml:lang="it">I due testi occupano quasi interamente il f. 245v. Essi sono separati dal testo principale
                                e tra di loro da semplici linee ornate. Una fascia a motivi fitomorfi chiude il secondo testo.</layout>
                            </layoutDesc>
                        </objectDesc>
                        <handDesc>
                            <handNote xml:lang="it">Maiuscola ogivale diritta</handNote>
                        </handDesc>
                    </physDesc>
                    <history>
                        <origin>
                            <origPlace>Place of origin</origPlace>
                            <origDate when="0056" precision="high" evidence="internal-date" datingMethod="#julian"/>
                                <p xml:lang="it"></p>
                                <p xml:lang="en"></p>
                        </origin>
                        <provenance type="found"> Findspot and circumstances/context
                        </provenance>
                        <provenance type="observed">Modern location(s) (if different from repository, above)
                        </provenance>
                    </history>
                </msDesc>
            </sourceDesc>
        </fileDesc>
    </teiHeader>
    <facsimile>         
        <graphic url="colophon.010.jpg"><desc>Vat. Pal. gr. 44, f. 245v</desc></graphic> 
    </facsimile>
    <text>
        <body>
            <div type="edition" xml:lang="grc" xml:space="preserve">
            <div type="textpart" n="A" xml:id="A"> 
                <ab> 
                    <lb n="1"/><g type="cross">+</g> ὡς <choice><reg>ἡδὺ</reg><orig>ϊδὺ</orig></choice> τοῖς πλέουσιν εὔδιος λιμὴν 
                    <lb n="2"/>οὕτως καὶ τοις γραφουσιν ὁ <choice><orig>ΰστατος</orig><reg>ὔστατος</reg></choice> στίχος. 
                </ab>
            </div>

            <div type="textpart" n="B"> <!--agguyngere a lexicon.xml γράφω δέλτος ἑρμηνευτής ψαλτήρ ταβουλάριος 
                                            aggiungere a persons.xml λεων.ταβουλαριος-->
                <ab>  
                    <lb n="1"/><unclear><g type="cross">+</g></unclear> <rs type="lex" ref="#γράφω"><w lemma="γράφω">ἐγράφη</w></rs> οὖν 
                      ἡ <rs type="lex" ref="#παρών"><w lemma="παρών">παροῦσα</w></rs> 
                      <rs type="lex" ref="#δέλτος"><w lemma="δέλτος">δέλτος</w></rs> τοῦ 
                   <lb n="2"/><rs type="lex" ref="#ἑρμηνευτής"><w lemma="ἑρμηνευτής">ἐρμηνευτοῦ</w></rs> 
                      <rs type="lex" ref="ψαλτήρ"><w lemma="ψαλτήρ">ψαλτήρος</w></rs> δια 
                      <rs type="lex" ref="#χείρ"><w lemma="χείρ">χειρὸς</w></rs> 
                    <lb n="3"/><persName type="copist" ref="#λεων.ταβουλαριος">Λέωντος</persName> 
                      <rs type="app" ref="#ταβουλάριος"><w lemma="ταβουλάριος">ταβουλαρίου</w></rs> Μονοβα
                    <lb n="4" break="no"/>σίας <expan><abbr>μη</abbr><ex>νι</ex></expan> αὐγούστῳ 
                      <num value="28"><hi rend="supraline">κη</hi></num> 
                      <expan><abbr>ἡμέ</abbr><ex>ρᾳ</ex></expan> <num value="2"><hi rend="supraline">β</hi></num> 
                      <expan><abbr>ἰνδ</abbr><ex>ικτιῶνος</ex></expan> <supplied reason="lost"><num value="1">α</num></supplied>
                    <lb n="5"/> ἔτους <num value="6405"><hi rend="supraline"><unclear>ϛ</unclear>υε</hi></num> -· 
                    <lb n="6"/>ὁ ἀναγινώσκων εὔχου μοι <choice><orig>δια</orig><reg>διὰ</reg></choice> τὸν <expan><abbr><hi rend="supraline">κ</hi></abbr><ex>υρίο</ex><abbr><hi rend="supraline">ν</hi></abbr></expan> 
                    <lb n="7"/>ὅπως <choice><orig>λυτρωθω</orig><reg>λυτρωθῶ</reg></choice> <choice><orig>του</orig><reg>τοῦ</reg></choice> 
                      <choice><orig>πυρος</orig><reg>πυρὸς</reg></choice> τῆς Γεαίννης.
                </ab>
            </div>
            </div>
            <div type="apparatus">
            </div>
            <div type="translation" xml:lang="it" resp="Luca De Curtis">
                <p corresp="A"> Come è cosa dolce per coloro che navigano il porto tranquillo, così per coloro che scrivono è l'ultima riga.
                </p>

                <p corresp="B">
                </p>
            </div>
            <div type="commentary">
                <p>
                    <seg xml:lang="it">Il colofone vero e proprio è costituito dal testo B.</seg>
                </p>
            </div>
            <div type="bibliography">
                <p></p>
            </div>
        </body>
    </text>
</TEI>

现在,我想自定义 xls 样式表以显示

<msIdentifier>
的所有子项,但不包括
<altIdentifier>
。这是我正在使用的模板:

<xsl:template name="greco-body-structure">
    <xsl:call-template name="greco-navigation"/>
    <div id="greco-inscription-body" class="greco">
      <div id="title" class="greco">
        <h1><xsl:if test="//t:idno[@type='projectNo']/text()"><xsl:value-of select="number(//t:idno[@type='projectNo'])"/>. </xsl:if><xsl:apply-templates select="//t:titleStmt/t:title"/></h1>
      </div>
      
      
      <div id="descriptive_lemma" class="greco">
        <p><b>Segnatura: </b> <!--Vedere come selezionare ms identifier senza altidentifier-->
          <xsl:choose>
            <xsl:when test="//t:msDesc/t:msIdentifier">
              <xsl:apply-templates select="//t:msDesc/t:msIdentifier">
            </xsl:when>
            <xsl:otherwise>?</xsl:otherwise>
          </xsl:choose>
        </p>
</div>
</div>
</xsl:template>

我试过像

<xsl:apply-templates select="//t:msDesc/t:msIdentifier[not(/altIdentifier)]">
这样的东西,但它不起作用,它仍然显示
Città del Vaticano Biblioteca Apostolica Vaticana Pal. gr. 44 65777
而不是
Città del Vaticano Biblioteca Apostolica Vaticana Pal. gr. 44
(没有最后一个ID号)。 谁能帮忙?

xls tei
1个回答
0
投票

如果您将模板应用于某些子树并希望不处理/复制某些元素或其他节点,请确保添加一个空模板,例如

<xsl:template match="t:msIdentifier/t:altIdentifier"/>
这样节点就不会产生任何输出。

select
xsl:apply-templates
属性级别,您可以使用
except
来使用例如
* except foo
将模板应用于除
foo
子元素之外的所有子元素,但我认为如果您将模板应用于某个
msIdentifier
但想排除它的某些后代产生输出,那将无济于事;为此,如上所述,添加一个空模板。

© www.soinside.com 2019 - 2024. All rights reserved.