Select the value of the attribute with XSLT

1

I'm trying to get the proper names (@name type="Antropónimo") from the following XML from an XSLT stylesheet. At the moment I have only managed to extract all the names that are in the document. I would need to add the attribute type="Antropónimo" to the style sheet How can I do it? The XML and the XSLT that I have are these:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:tei="http://www.tei-c.org/ns/1.0">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html lang="es">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            </head>
            <body>
                <h3 align="center">
                    <b>NOMBRES PROPIOS</b>
                </h3>
                <table width="750" border="1" align="center">
                    <tr>
                        <th scope="col" bgcolor="#00CCFF">
                            <div align="center">Nombre</div>
                        </th>
                        <th scope="col" bgcolor="#00CCFF">
                            <div align="center">Libro</div>
                        </th>
                        <th scope="col" bgcolor="#00CCFF">
                            <div align="center">Capítulo</div>
                        </th>
                        <th scope="col" bgcolor="#00CCFF">
                            <div align="center">Folio</div>
                        </th>
                        <th scope="col" bgcolor="#00CCFF">
                            <div align="center">Columna</div>
                        </th>
                        <th scope="col" bgcolor="#00CCFF">
                            <div align="center">Línea</div>
                        </th>
                    </tr>

                    <tr>

                        <td>
                            <xsl:for-each select="//tei:div1//tei:name">
                                <div align="center">
                                    <xsl:value-of select="."/>
                                </div>
                            </xsl:for-each>
                        </td>
                        <td>
                            <xsl:for-each select="//tei:div1//tei:name">
                                <div align="center">
                                    <xsl:value-of select="ancestor::tei:div1/@n"/>
                                </div>
                            </xsl:for-each>
                        </td>
                        <td>
                            <xsl:for-each select="//tei:div1//tei:name">
                                <div align="center">
                                    <xsl:value-of select="ancestor::tei:div2/@n"/>
                                </div>
                            </xsl:for-each>
                        </td>
                        <td>
                            <xsl:for-each select="//tei:div1//tei:name">
                                <div align="center">
                                    <xsl:value-of select="ancestor::tei:div2//tei:pb/@n"/>
                                </div>
                            </xsl:for-each>
                        </td>
                        <td>
                            <xsl:for-each select="//tei:div1//tei:name">
                                <div align="center">
                                    <xsl:value-of select="ancestor::tei:div2//tei:cb/@n"/>
                                </div>
                            </xsl:for-each>
                        </td>
                        <td>
                            <xsl:for-each select="//tei:div1//tei:name">
                                <div align="center">
                                    <xsl:value-of select="ancestor::tei:div2//tei:lb/@n"/>
                                </div>
                            </xsl:for-each>
                        </td>
                    </tr>
                </table>
            </body>
        </html>

    </xsl:template>



</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml"
	schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-stylesheet type="text/xsl" href="antroponimos2.xsl"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>Title</title>
      </titleStmt>
      <publicationStmt>
        <p>Publication Information</p>
      </publicationStmt>
      <sourceDesc>
        <p>Information about the source</p>
      </sourceDesc>
    </fileDesc>
  </teiHeader>
  <text>
    <body>
      <div1 type="book" n="01">
        <div2 type="chapter" n="000">
          <pb n="001r"/>
          <cb n="a"/>
          <head>
            <hi rend="red"><lb n="1"/>Aqui se comiença <lb n="2"/>la general &amp; grand es<lb n="3"
              />toria que el muy noble <w type="majuscule">Rey</w>
              <lb n="4"/>don alfonso fijo del noble <w type="majuscule">Rey</w>
              <lb n="5"/>don fernando &amp; dela <w type="majuscule">Reyna</w>
              <lb n="6"/>donna beatriz mando fazer. <lb n="7"/>Prólogo.</hi>
          </head>
          <ab>
            <lb n="8"/>
            <seg type="invocatio">Natural co <lb n="9"/>sa es de cob<lb n="10"/>diciar los <lb
                n="11"/>omnes saber<lb n="12"/>los fechos<lb n="13"/>que acahescen<lb n="14"/>en
              todos los<lb n="15"/>tiempos. <phr function="comparative"><phr function="comparative"
                  n="1">tan<lb n="16"/>bien enel<lb n="17"/>tiempo que es<lb n="18"/>passado</phr>.
                  <phr function="comparative" n="12">como en aquel en que estan</phr>
                <phr function="comparative" n="final">como<lb n="19"/>enl' otro que ha de
                  uenir</phr>.</phr></seg> ¶ Pero destos<lb n="20"/>tres tiempos non puede omne seer
            cierto. <phr function="adversative">fu<lb n="21"/>eras da quel que es passado</phr>. ¶
              <phr function="causal">Ca <phr function="conditional"><phr function="conditional"
                  n="prot">si es del ti<lb n="22"/>empo que ha de uenir</phr>. <phr
                  function="conditional" n="apo">non pueden los omnes<lb n="23"/>seer <phr
                    type="sytagm" function="copulative"><phr type="sytagm" function="copulative"
                      n="1">el comienço</phr>
                    <phr type="sytagm" function="copulative" n="2">njn la fin delas cosas</phr>
                    <phr function="adjetive" type="restrictive">que ý<lb n="24"
                  />auernan</phr></phr></phr></phr>. &amp; <phr function="consecutive">por ende
                nonlo saben cierta mi<lb n="25"/>entre</phr>. ¶ Et <phr function="conditional"><phr
                  function="conditional" n="prot">si es del tiempo en que estan. <phr
                    function="concessive">ma<lb n="26"/>guer saben los comienços delos fechos que<lb
                      n="27"/>enel se fazen</phr></phr>. <phr function="conditional" n="2"><phr
                    function="causal">por que non pueden saber la fin<lb n="28"/>qual sera</phr>.
                  tenemos que non lo saben complida<lb n="29"/>mientre</phr></phr></phr>. ¶ <phr
              function="adversative">Mas <phr type="hyperbaton">del tiempo passado <phr
                  function="causal">por que<lb n="30"/>saben los comienços &amp; los acabamientos<lb
                    n="31"/>delos fechos <phr function="adjetive" type="restrictive">que y se
                    fizieron</phr></phr>. dezimos que<lb n="32"/>alcançan los omnes por este tiempo
                cierta mi<lb n="33"/>entre. el saber delas cosas <phr function="adjetive"
                  type="restrictive">que fueron</phr></phr></phr>. ¶On<lb n="34"/>de <phr
              function="causal">por que <phr type="coord" function="copulative"><phr type="coord"
                  function="copulative" n="1">el saber del tiempo <phr function="adjetive"
                    type="restrictive">que fue</phr> es cierto</phr>.<lb n="35"/>&amp; <phr
                  type="coord" function="copulative" n="2">non delos otros dos tiempos</phr></phr>
              <phr function="anaphoric">assi como dixi<lb n="36"/>emos</phr></phr>. trabaiaron se
            los sabios omnes de <cb n="b"/>
            <lb n="1"/>meter en escripto los fechos <phr function="adjetive" type="restrictive">que
              son passados</phr><lb n="2"/><phr function="final">pora <phr type="coord"
                function="copulative"><phr type="coord" function="copulative" n="1">auer remenbrança
                  dellos. como si eston<lb n="3"/>çes fuessen</phr>. &amp; <phr type="coord"
                  function="copulative" n="2">quelo sopiessen <phr type="sytagm"
                    function="copulative" n="1">los que aujen de<lb n="4"/>uenir</phr>
                  <phr type="sytagm" function="copulative" n="2">assi como
              ellos</phr></phr></phr></phr>. Et fizieron desto mu<lb n="5"/>chos libros que son
            llamados estorias &amp; gestas<lb n="6"/>en que contaron delos fechos de dios &amp;
              delos<lb n="7"/>prophetas. &amp; delos santos. Et otrossi delos Reyes. &amp;<lb n="8"
            />delos altos omnes. &amp; delas cauallerias &amp; delos<lb n="9"/>pueblos. &amp;
            dixieron la uerdat de todas las co<lb n="10"/>sas. &amp; non quisieron nada encobrir.
            tan bien delos<lb n=""/>que fueron buenos. como delos que fueron malos.<lb n="11"/><add
              place="margin"> Et</add>esto fizieron. por que delos fechos delos bue<lb n="12"/>nos.
            tomassen los omnes exemplo pora fazer<lb n="13"/>bien. Et delos fechos delos malos que
              reçibies<lb n="14"/>sen castigo. por se saber guardar delo non fazer.<lb n="15"/>ONde
            por todas estas cosas. yo don<lb n="16"/><name type="Antropónimo" n="in">Alfonsso</name>
            por la gracia de dios <phr type="apposition">Rey <phr function="list"><phr
                  function="list" n="1">de<lb n="17"/><name type="place" n="in"
                  >Castiella</name></phr>. <phr function="list" n="2">de <name type="place" n="in"
                    >Toledo</name></phr>. <phr function="list" n="3">de <name type="place" n="in"
                    >Leon</name></phr>. <phr function="list" n="4">de <name type="place" n="in"
                      >Gal<lb n="18"/>lizia</name></phr>. <phr function="list" n="5">de <name
                    type="place" n="in">Seuilla</name></phr>. <phr function="list" n="6">de <name
                    type="place" n="in">Cordoua</name></phr>
                <phr function="list" n="7">de <name type="place" n="in">Mur<lb n="19"
                  />cia</name></phr>. <phr function="list" n="7">de <name type="place" n="in"
                    >Iahen</name></phr>. &amp; <phr function="list" n="8">del <name type="place"
                    n="in">Algarbe</name></phr></phr></phr>. <phr type="apposition">fijo del muy<lb
                n="20"/>Noble Rey <phr type="apposition">don <name type="Antropónimo" n="in"
                  >Fernando</name></phr>. &amp; dela muy<lb n="21"/>Noble Reyna <phr
                type="apposition">donna <name type="Antropónimo" n="in">Beatriz</name></phr></phr>.
            ¶ Despu<lb n="22"/>es que oue fecho ayuntar muchos escriptos &amp;<lb n="23"/>muchas
            estorias delos fechos antiguos. esco<lb n="24"/>gi dellos los mas uerdaderos &amp; los
              meiores<lb n="25"/>que y sope. &amp; fiz ende fazer este libro. &amp; man<lb n="26"
            />de y poner todos los fechos sennalados tan<lb n="27"/>bien delas estorias dela <name
              type="book">biblia</name>. como delas o<lb n="28"/>tras grandes cosas que acahesçieron
            por el mun<lb n="29"/>do. desde que fue començado fastal nuestro tiempo.<lb n="30"/>
          </ab>
        </div2>

        <div2 type="chapter" n="001">
          <pb n="001r"/>
          <cb n="b"/>
          <head>
            <hi rend="red">Delas obras que <name type="Antropónimo">dios</name> fizo en los prime<lb
                n="31"/>ros <num>.vj.</num> dias.</hi>
          </head>
          <ab><add place="margin">I</add>
            <phr function="time">Quando nuestro sennor <lb n="32"/><name type="Antropónimo"
                >dios</name> crio enel comienço <phr type="syntagm" function="copulative">el
                  çielo<lb n="33"/>et la tierra &amp; todas las cosas <phr function="adjetive"
                  type="restrictive">que<lb n="34"/>enellos son</phr></phr></phr>. <phr
              function="inciso" type="source" n="moysen">segund quelo cuenta <name
                type="Antropónimo">moysen</name>
              <phr function="adjetive" type="restrictive">que fue<lb n="35"/><phr type="syntagm"
                  function="copulative"><phr type="syntagm" function="copulative" n="1">santo</phr>
                  &amp; <phr type="syntagm" function="copulative" n="2">sabio</phr></phr></phr>.
              &amp; otros muchos <phr function="adjetive" type="restrictive">que acordaron con
                el</phr></phr>. <lb n="36"/>departiolo &amp; fizo lo todo en seys dias <phr
              function="cataphoric">desta<lb n="37"/>guisa</phr>. <phr function="list">¶ <phr
                function="list" n="1">El primero dia crio <phr type="syntagm" function="copulative"
                    ><phr type="syntagm" function="copulative" n="1">la luz</phr>. &amp; <phr
                    type="syntagm" function="copulative" n="2">todas<lb n="38"/>las naturas delos
                    angeles buenos et malos.<lb n="39"/><phr function="adjetive" type="explanatory"
                      >que son las criaturas spiritales</phr></phr></phr></phr>. ¶ Et partio<lb
                n="40"/>esse dia la luz delas tiniebras. Et <phr type="coord" function="copulative"
                >ala luz<lb n="41"/>
                <pb n="001v"/>
                <cb n="a"/><lb n="1"/> llamo dia. &amp; alas tiniebras noche</phr>. ¶ <phr
                function="list" n="1">El<lb n="2"/> segundo dia <phr type="coord"
                  function="copulative">fizo el firmamento. &amp; partio con el<lb n="3"/> las aguas
                  de suso delas de deyuso</phr></phr>. ¶ <phr function="list" n="4">El terce<lb
                  n="3"/>ro dia ayunto todas las aguas <phr function="adjetive" type="restrictive"
                  >que so el çielo<lb n="5"/> son. <phr function="explicative"><phr type="syntagm"
                      function="copulative">los mares &amp; las otras aguas dulces</phr>. <phr
                      function="explicative"><phr type="syntagm" function="copulative">de<lb n="6"/>
                        rios &amp; de fuentes</phr></phr></phr></phr>. &amp; <phr function="time"
                  >quando las aguas fueron <phr type="syntagm" function="copulative">a<lb n="7"
                    />partadas &amp; <phr type="syntagm" function="copulative" n="1">ayuntadas en un
                      logar</phr></phr>. paresçio<lb n="8"/> lo seco que es dicho tierra. Et crio
                  estonçes <name type="Antropónimo">dios</name> en<lb n="9"/> la tierra <phr
                    type="syntagm" function="copulative">las yeruas &amp; los aruoles de todas<lb
                      n="10"/> naturas</phr></phr>. ¶ <phr function="list" n="4">El quarto alumbro
                    <phr type="syntagm" function="copulative">los çielos &amp; la ti<lb n="11"
                    />erra</phr>
                  <phr type="syntagm" function="copulative">con el sol &amp; con la luna &amp; con
                    las estrellas</phr>.<lb n="12"/> &amp; puso las enel firmamento. <phr
                    type="coord" function="copulative">El sol pora el dia.<lb n="13"/> &amp; la luna
                    &amp; las estrellas pora la noche</phr></phr>. ¶ <phr function="list" n="5"
                    >El<lb n="14"/> quinto dia fizo <phr type="syntagm" function="copulative">los
                    peçes &amp; las aues de todas<lb n="15"/> maneras</phr>. Et <phr type="coord"
                    function="copulative">bendixo los &amp; dixo que <phr type="coord"
                      function="copulative">creçiessen<lb n="16"/> &amp; amuchiguassen. &amp;
                      enchiessen <phr type="syntagm" function="copulative">las aguas<lb n="17"/>
                        &amp; la tierra</phr></phr></phr></phr>. ¶ El sexto dia crio <phr
                  type="syntagm" function="copulative">las bestias<lb n="18"/> grandes &amp; las
                  pequennas de todas naturas</phr></phr>.</phr> ¶ Et<lb n="19"/> esse dia mesmo
            formo all omne <phr type="syntagm" function="copulative">a su yma<lb n="20"/> gen &amp;
              asu semeiança</phr> que fuesse adelantado &amp; se<lb n="21"/>nnor de todas las otras
            criaturas <phr function="adjetive" type="restrictive">que so el cielo son</phr>.<lb
              n="22"/>
            <add place="margin"> ¶</add>
            <phr function="inciso" type="absolute">Et faziendol <phr type="syntagm"
                function="copulative">asu ymagen &amp; asu semeiança</phr></phr>. crio<lb n="23"/>
            <phr type="syntagm" function="copulative">los maslo &amp; fenbra</phr>. <phr
              function="inciso" type="source" n="moysen y iheronimo">assi como lo departen<lb n="24"/>
              <phr type="syntagm" function="copulative"><name type="Antropónimo">moysen</name></phr>
              &amp; <phr type="syntagm" function="copulative" n="2"><name type="Antropónimo"
                  >iheronimo</name></phr></phr> enel primero capitulo<lb n="25"/> del <name
              type="book">genesis</name>. <phr function="list" n="2">Et <name type="Antropónimo"
                >iosepho</name> otrossi enel primero<lb n="26"/> dela estoria dela antiguedat delos
              iudios</phr>.<lb n="27"/>
            <phr function="list" n="final"><add place="margin"> Et</add> otros muchos quelo affirman
              con ellos</phr>. Et desi<lb n="28"/> bendixo los <name type="Antropónimo">dios</name>
            &amp; dixo les <quote type="indirect" source="Dios"><phr type="coord"
                function="copulative">que creçiessen &amp;<lb n="29"/> amuchiguassen</phr> &amp;
              enchiessen la tierra. &amp; quela<lb n="30"/> assennoreassen so el su poder</quote>.
              <phr function="incise" type="absolute">bendiziendo a<lb n="31"/> ellos</phr>. bendixo
            alas animalias dela tierra<lb n="32"/> en ellos. ¶ Et mando que<phr type="syntagm"
              function="copulative">los omnes &amp; </phr><lb n="33"/>animalias. <phr type="coord"
              function="copulative">comiessen &amp; uisquiessen <phr type="syntagm"
                function="copulative">delas yeruas<lb n="34"/> dela tierra &amp; <phr
                  function="list" n="3">delas simientes della</phr>. &amp; delas<lb n="35"/> fruytas
                delos aruoles</phr></phr>. ¶ <phr type="syntagm" function="cc">Enpos esto to<lb
                n="36"/>do</phr> cato nuestro sennor <name type="Antropónimo">dios</name> todas las
            cosas <phr function="adjetive" type="restrictive">que<lb n="37"/> auie fechas</phr>:'
            &amp; uio que eran muy buenas.<lb n="38"/>
            <add place="margin"> Et</add> fue todo acabado de fazer. <phr type="syntagm"
              function="atypical">enel sexto di<lb n="39"/> a</phr>. <phr function="cataphoric"><phr
                function="inciso" type="source" n="Moises">Como oyredes que diz <name
                  type="Antropónimo">moysen</name> adelante</phr></phr>.<lb n="40"/>
          </ab>
        </div2>
      </div1>
    </body>
  </text>
</TEI>
    
asked by Miguel Las Heras 12.03.2018 в 17:10
source

1 answer

1

select="//div1//name[@type='Antropónimo']" using these Paths Xpath works perfectly

    
answered by 16.05.2018 в 18:12