<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:tei="http://www.tei-c.org/ns/1.0" 
                xmlns:ct="http://www.comhartaighde.com/ns/1.0" 
                exclude-result-prefixes="tei ct"
                version="1.0">
<xsl:output method="xml" omit-xml-declaration="no" indent="yes" />
    

<xsl:include href="_variables.xsl"/>
    

<!--ainmspáis a bhaint de gach nód-->
<xsl:template match="*" name="identity">
  <xsl:element name="{name()}">
    <xsl:apply-templates select="node()|@*" />
  </xsl:element>
</xsl:template>

<!--an t-inneachar uilig a chóipeáil-->
<xsl:template match="node()|@*" priority="-2">
  <xsl:copy>
    <xsl:apply-templates select="node()|@*" />
  </xsl:copy>
</xsl:template>
    

<!--eilimintí--> 
<xsl:template match="alt">
    <TEI><xsl:apply-templates/></TEI>
</xsl:template>
    
<xsl:template match="ceanntásc">
    <teiHeader><fileDesc><xsl:apply-templates/></fileDesc></teiHeader>
</xsl:template>
    
<xsl:template match="príomhshonraí">
    <titleStmt><xsl:apply-templates/></titleStmt>
</xsl:template>
    
<xsl:template match="údar">
    <author><xsl:apply-templates/></author>
</xsl:template>
    
<xsl:template match="duine">
    <persName><xsl:apply-templates/></persName>
</xsl:template>
    
<xsl:template match="céadainm">
    <forename><xsl:apply-templates/></forename>
</xsl:template>
    
<xsl:template match="sloinne">
    <surname><xsl:apply-templates/></surname>
</xsl:template>

<xsl:template match="cleamhnacht">
    <affiliation><xsl:apply-templates/></affiliation>
</xsl:template>
 
<xsl:template match="ríomhphost">
    <email><xsl:apply-templates/></email>
</xsl:template>

<xsl:template match="cineálAilt">
    <articleType><xsl:apply-templates/></articleType>
</xsl:template>
    
<xsl:template match="DOI">
    <idno><xsl:apply-templates/></idno>
</xsl:template>
    
<xsl:template match="eagrán">
    <editionStmt>
        <xsl:element name="edition">
            <xsl:attribute name="n"><xsl:value-of select="@uimh"/></xsl:attribute>
            <xsl:apply-templates/>
        </xsl:element>
    </editionStmt> 
</xsl:template>
    
<xsl:template match="foilseachán">
    <publicationStmt><xsl:apply-templates/></publicationStmt>
</xsl:template>
    
<xsl:template match="foilsitheoir">
    <publisher><xsl:apply-templates/></publisher>
</xsl:template>
    
<xsl:template match="ISSN">
    <idno><xsl:apply-templates/></idno>
</xsl:template>
    
<xsl:template match="dáta">
    <date><xsl:apply-templates/></date>
</xsl:template>
    
<xsl:template match="bliain">
    <year><xsl:apply-templates/></year>
</xsl:template>
    
<xsl:template match="mí">
    <month><xsl:apply-templates/></month>
</xsl:template>
    
<xsl:template match="lá">
    <day><xsl:apply-templates/></day>
</xsl:template>
    
<xsl:template match="foilseachán/áit">
    <pubPlace><xsl:apply-templates/></pubPlace>
</xsl:template>
    
<xsl:template match="infhaighteacht">
    <xsl:element name="availability">
        <xsl:attribute name="status"><xsl:if test="(@stádas)='teoranta'">restricted</xsl:if></xsl:attribute>
        <xsl:apply-templates/>
    </xsl:element>
</xsl:template>
    
<xsl:template match="ceadúnas">
    <licence><xsl:apply-templates/></licence>
</xsl:template>
    
<xsl:template match="próifíl">
    <profileDesc><xsl:apply-templates/></profileDesc>
</xsl:template>
    
<xsl:template match="aicmiú">
    <textClass><xsl:apply-templates/></textClass>
</xsl:template>
    
<xsl:template match="eochairfhocail">
    <keywords><xsl:apply-templates/></keywords>
</xsl:template>
    
<xsl:template match="téarma">
    <term><xsl:apply-templates/></term>
</xsl:template>
    
<xsl:template match="léirmheas">
    <reviewObject><xsl:apply-templates/></reviewObject>
</xsl:template>
    
<xsl:template match="teideal">
    <title><xsl:apply-templates/></title>
</xsl:template>
    
<xsl:template match="leathanaigh">
    <pages><xsl:apply-templates/></pages>
</xsl:template>
    
<xsl:template match="praghas">
    <price><xsl:apply-templates/></price>
</xsl:template>
    
<xsl:template match="téacs">
    <text><xsl:apply-templates/></text>
</xsl:template>
    
<xsl:template match="corp">
    <body><xsl:apply-templates/></body>
</xsl:template>
    
<xsl:template match="téacs/corp/corpAilt/téacs">
    <xsl:apply-templates/><xsl:text>&#13;</xsl:text>
</xsl:template>
    
<xsl:template match="téacs/corp/corpAilt/téacs/corp">
    <xsl:apply-templates/><xsl:text>&#13;</xsl:text>
</xsl:template>
    
<xsl:template match="tagairt">
    <ref><xsl:apply-templates/></ref>
</xsl:template>
    
<xsl:template match="téacs/corp/véarsa">
    <verse>
        <xsl:apply-templates/>
        <xsl:text>&#13;</xsl:text>
    </verse>
</xsl:template>

<xsl:template match="téacs/corp/véarsa/l/tagairt">
    <xsl:text> </xsl:text><xsl:apply-templates/>
</xsl:template>
    
<xsl:template match="téacs/corp/véarsa/l">
    <l><xsl:apply-templates/><xsl:text>&#13;</xsl:text></l>
</xsl:template>
    
<xsl:template match="//téacs/corp/véarsa/l[last()]">
    <lastL><xsl:apply-templates/><xsl:text>&#13;</xsl:text></lastL>
</xsl:template>
    
<xsl:template match="ceann">
    <head><xsl:apply-templates/></head>
</xsl:template>
 
<xsl:template match="liostaBibl">
    <listBibl><xsl:apply-templates/></listBibl>
</xsl:template>
    
<xsl:template match="corp/achoimre[@xml:lang='ga']">
    <abstract><xsl:apply-templates/></abstract>
</xsl:template>
    
<xsl:template match="corp/corpAilt">
    <article><xsl:apply-templates/><xsl:apply-templates select="//div[@type='endnotes']" /></article>
</xsl:template>
    
<xsl:template match="corp/tagairtí">
    <bibliography><xsl:apply-templates/></bibliography>
</xsl:template>
    
    
<!--clóghrafaíocht-->  
<xsl:template match="//príomhshonraí/teideal">
    <articleTitle><xsl:apply-templates/></articleTitle>
</xsl:template> 
    
<xsl:template match="//p/teideal|//liosta//teideal|//corp//téacs//teideal|//béim|//codeSwitch|//iasacht|//monogr//teideal|tagairtí//bibl/teideal">
    <italics><xsl:apply-templates /></italics>
</xsl:template>
    
<xsl:template match="//athfhriotal//teideal|//athfhriotal//béim|//athfhriotal//iasacht">
    <quoteItalics><xsl:apply-templates /></quoteItalics>
</xsl:template>
    
<xsl:template match="//tagairt//teideal|//tagairt//béim|//tagairt//iasacht">
    <refItalics><xsl:apply-templates /></refItalics>
</xsl:template>
    
<xsl:template match="corp/corpAilt/ceann/teideal|corp/tagairtí//ceann/teideal|corp/corpAilt/ceann/iasacht|corp/corpAilt/ceann/béim">
    <headItalics><xsl:apply-templates /></headItalics>
</xsl:template>
    
<xsl:template match="briseadhLíne">
    <xsl:text>&#xa;</xsl:text>
</xsl:template>  
    
<xsl:template match="níosMó">
    <xsl:text>&gt;</xsl:text>
</xsl:template> 
    
<xsl:template match="níosLú">
    <xsl:text>&lt;</xsl:text>
</xsl:template> 

<xsl:template match="amparsan">
    <xsl:text>&amp;</xsl:text>
</xsl:template> 
    
<xsl:template match="tagairt/amparsan">
    <xsl:text>&amp;</xsl:text>
</xsl:template>

<xsl:template match="nasc/amparsan">
    <xsl:text>&amp;</xsl:text>
</xsl:template>
    
<xsl:template match="liosta[@cineál='uimhrithe']">
    <ol>
        <xsl:apply-templates/>
        <xsl:text>&#13;</xsl:text>
    </ol>
</xsl:template>
    
<xsl:template match="liosta[@cineál='uimhrithe']/mír">
    <numLi><xsl:apply-templates/><xsl:text>&#13;</xsl:text></numLi>
</xsl:template>
    
<xsl:template match="liosta[@cineál='uimhrithe']/mír[1]">
    <firstNumLi><xsl:apply-templates/><xsl:text>&#13;</xsl:text></firstNumLi>
</xsl:template>
    
<xsl:template match="//liosta[@cineál='uimhrithe']/mír[last()]">
    <lastNumLi><xsl:apply-templates/><xsl:text>&#13;</xsl:text></lastNumLi>
</xsl:template>
    
<xsl:template match="liosta[@cineál='urchair']">
    <ul>
        <xsl:apply-templates/>
        <xsl:text>&#13;</xsl:text>
    </ul>
</xsl:template>
    
<xsl:template match="liosta[@cineál='urchair']/mír">
    <bulletLi><xsl:apply-templates/><xsl:text>&#13;</xsl:text></bulletLi>
</xsl:template>
    
<xsl:template match="liosta[@cineál='urchair']/mír[1]">
    <firstBulletLi><xsl:apply-templates/><xsl:text>&#13;</xsl:text></firstBulletLi>
</xsl:template>
    
<xsl:template match="//liosta[@cineál='urchair']/mír[last()]">
    <lastBulletLi><xsl:apply-templates/><xsl:text>&#13;</xsl:text></lastBulletLi>
</xsl:template>
    
<xsl:template match="mioncheannlitreacha">
    <smallCaps><xsl:apply-templates /></smallCaps>
</xsl:template>
    
<xsl:template match="corp//p">
    <p><xsl:apply-templates/><xsl:text>&#13;</xsl:text></p>
</xsl:template>
    
<xsl:template match="athfhriotal">
    <quote><xsl:apply-templates/><xsl:text>&#13;</xsl:text></quote>
</xsl:template>

<xsl:template match="athfhriotal[@cineál='eangaithe']">
    <indentedQuote><xsl:apply-templates/><xsl:text>&#13;</xsl:text></indentedQuote>
</xsl:template>

<xsl:template match="athfhriotal[@cineál='eangaithe']/p">
    <indentP><xsl:apply-templates/><xsl:text>&#13;</xsl:text></indentP>
</xsl:template>

<xsl:template match="athfhriotal[@cineál='eangaithe']/p[last()]">
    <lastIndentP><xsl:apply-templates/><xsl:text>&#13;</xsl:text></lastIndentP>
</xsl:template>
    
<xsl:template match="//corp//téacs">
    <text><xsl:apply-templates/><xsl:text>&#13;</xsl:text></text>
</xsl:template>
    
<xsl:template match="//corp//téacs/text()|//corp//téacs/corp/text()|//corp//téacs/corp/véarsa/l/text()">
    <xsl:value-of select="normalize-space(.)"/>
</xsl:template>

<xsl:template match="//corp/achoimre/ceann">
    <abstractHead><xsl:apply-templates/><xsl:text>&#13;</xsl:text></abstractHead>
</xsl:template>
    
<xsl:template match="corp/corpAilt/ceann">
    <articleHead><xsl:apply-templates/><xsl:text>&#13;</xsl:text></articleHead>
</xsl:template>
    
<xsl:template match="tagairtí//liostaBibl/ceann[@xml:lang='ga']">
    <biblHead><xsl:apply-templates/><xsl:text>&#13;</xsl:text></biblHead>
</xsl:template>

<xsl:template match="//príomhshonraí/teideal/teideal|//príomhshonraí/teideal//iasacht|//príomhshonraí/teideal//béim">
    <articleTitleItalics><xsl:apply-templates /></articleTitleItalics>
</xsl:template>
    
<!--údair-->
<xsl:template match="//foinse">
    <xsl:choose>
        <xsl:when test="//léirmheas">
            <reviewerNames>
                <authorLabel>Léirmheas:<xsl:text> </xsl:text></authorLabel>
                <xsl:copy-of select="$authorNames"/>
            </reviewerNames>
        </xsl:when>
        <xsl:otherwise>
            <authorNames>
                <xsl:copy-of select="$authorNames"/>
            </authorNames>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
    
<!--léirmheas-->
    
<!--leathanach tosaigh/ceanntáisc/buntáisc-->
<xsl:template match="//blurba">
    
    <edDesc>
        <edLabel>Eagrán <xsl:value-of select="//eagrán/@uimh"/><xsl:text>&#13;</xsl:text></edLabel>
        <edDatum><xsl:copy-of select="$dateMY"/></edDatum>
    </edDesc>
    
    <articleDesc>
        <titleLabel><xsl:value-of select="//príomhshonraí/cineálAilt"/><xsl:text>&#13;</xsl:text></titleLabel>
        <titleDatum><xsl:copy-of select="//príomhshonraí/teideal[@xml:lang='ga']"/></titleDatum>
    </articleDesc>
    
    <frontMatter>
        <frontLabel>Dáta foilsithe:<xsl:text>&#13;</xsl:text></frontLabel>
        <frontDatum>
            <xsl:value-of select="//foilseachán/dáta/lá"/>
            <xsl:text> </xsl:text>
            <xsl:copy-of select="$dateMY"/>
            <xsl:text>&#13;</xsl:text>
            <xsl:text>&#13;</xsl:text>
        </frontDatum>
        
        <frontLabel>Cóipcheart:<xsl:text>&#13;</xsl:text></frontLabel>
        <frontDatum>
            <xsl:if test="(//foilseachán/infhaighteacht/ceadúnas/@cineál) = 'údar'">© <xsl:copy-of select="$authorNames"/>, <xsl:value-of select="//foilseachán/dáta/bliain"/><xsl:if test="//eagrán/@uimh &gt; 5"><xsl:text> (CC BY-NC)</xsl:text></xsl:if><xsl:text>&#13;</xsl:text><xsl:text>&#13;</xsl:text></xsl:if>
        </frontDatum>
        
        <frontLabel>Seoladh gréasáin:<xsl:text>&#13;</xsl:text></frontLabel>
        <frontDatum>https://old.comhartaighde.ie/eagrain/<xsl:value-of select="//eagrán/@uimh"/>/<xsl:value-of select="//aitheantóir"/>/<xsl:text>&#13;</xsl:text><xsl:text>&#13;</xsl:text></frontDatum>
       
        <frontLabel>
            <xsl:choose>
                <xsl:when test="(//príomhshonraí/cineálAilt[@xml:lang='ga']) = 'Léirmheas'">
                    <xsl:choose> 
                        <xsl:when test="count(//príomhshonraí/údar) &gt; 1">Léirmheastóirí:</xsl:when>
                        <xsl:otherwise>Léirmheastóir:</xsl:otherwise>
                    </xsl:choose>                 
                </xsl:when>
                <xsl:otherwise>
                    <xsl:choose> 
                        <xsl:when test="count(//príomhshonraí/údar) &gt; 1">Údair:</xsl:when>
                        <xsl:otherwise>Údar:</xsl:otherwise>
                    </xsl:choose> 
                </xsl:otherwise>
            </xsl:choose>
            <xsl:text>&#13;</xsl:text>
        </frontLabel>
        <frontDatum>
            <xsl:for-each select="//príomhshonraí/údar/duine"><xsl:value-of select="."/><xsl:text>&#13;</xsl:text></xsl:for-each>
            <xsl:text>&#13;</xsl:text>
        </frontDatum>
        
        <xsl:if test="//príomhshonraí/údar/ríomhphost">
            <frontLabel>Comhfhreagras:<xsl:text>&#13;</xsl:text></frontLabel>
            <frontDatum>
                <xsl:for-each select="//príomhshonraí/údar/ríomhphost"><xsl:value-of select="."/><xsl:text>&#13;</xsl:text></xsl:for-each><xsl:text>&#13;</xsl:text>
            </frontDatum>
        </xsl:if>    
        
        <xsl:if test="//príomhshonraí/DOI">
            <frontLabel>Seoladh seasmhach (DOI):<xsl:text>&#13;</xsl:text></frontLabel>
            <frontDatum><xsl:text>https://doi.org/10.18669/</xsl:text><xsl:value-of select="//príomhshonraí/DOI"/>
                <xsl:text>&#13;</xsl:text>
            </frontDatum>
        </xsl:if>
    </frontMatter>
    
    <runningHeader>
        <runHeadCOMHAR>COMHAR</runHeadCOMHAR><runHeadTaighde>Taighde</runHeadTaighde>
        <runHeadEd><xsl:text> | Eagrán </xsl:text></runHeadEd>
        <xsl:value-of select="//eagrán/@uimh"/>
        <xsl:text> | </xsl:text>
        <runHeadDate><xsl:copy-of select="$dateMY"/></runHeadDate>
    </runningHeader>
    
    <runningHeader>
        <runHeadCOMHAR>COMHAR</runHeadCOMHAR><runHeadTaighde>Taighde</runHeadTaighde>
        <runHeadEd><xsl:text> | Eagrán </xsl:text></runHeadEd>
        <xsl:value-of select="//eagrán/@uimh"/>
        <xsl:text> | </xsl:text>
        <runHeadDate><xsl:copy-of select="$dateMY"/></runHeadDate>
    </runningHeader>
    
    <runningFooter>
        <runAuthors>
            <xsl:copy-of select="$authorNamesShort"/>
        </runAuthors>
        <xsl:if test="//príomhshonraí/DOI">
            <runDOI><xsl:text>http://dx.doi.org/10.18669/</xsl:text><xsl:value-of select="//príomhshonraí/DOI"/></runDOI>
        </xsl:if>
    </runningFooter>
    
    <runningFooter>
        <runAuthors>
            <xsl:copy-of select="$authorNamesShort"/>
        </runAuthors>
        <xsl:if test="//príomhshonraí/DOI">
            <runDOI><xsl:text>http://dx.doi.org/10.18669/</xsl:text><xsl:value-of select="//príomhshonraí/DOI"/></runDOI>
        </xsl:if>
    </runningFooter>
    
    <xsl:if test="//léirmheas">
        <reviewObjects>
            <xsl:for-each select="//léirmheas/bibl">
                <reviewObject>
                    <reviewLabel>Teideal:<xsl:text>&#13;</xsl:text></reviewLabel>
                    <reviewObjectTitle><xsl:value-of select="title"/><xsl:text>&#13;</xsl:text></reviewObjectTitle>
                    <reviewLabel>Bliain:<xsl:text>&#13;</xsl:text></reviewLabel>
                    <reviewObjectDate><xsl:value-of select="date"/><xsl:text>&#13;</xsl:text></reviewObjectDate>
                    <xsl:if test="údar">
                        <reviewObjectAuthors>
                            <xsl:for-each select="údar/duine">
                               <xsl:value-of select="."/>
                               <xsl:if test="count(//ceanntásc/léirmheas/bibl/údar) &gt; 2">
                                   <xsl:if test="position() != last()-1 and position() != last()"><xsl:text>, </xsl:text></xsl:if>
                               </xsl:if>
                               <xsl:if test="count(//ceanntásc/léirmheas/bibl/údar) &gt; 1">
                                   <xsl:if test="position() = last()-1"><xsl:text> agus </xsl:text></xsl:if>
                               </xsl:if>
                            </xsl:for-each>
                            <xsl:text>&#13;</xsl:text>
                        </reviewObjectAuthors>
                    </xsl:if>
                    <xsl:if test="eagarthóir">
                        <reviewObjectEds>
                            <xsl:for-each select="eagarthóir/duine">
                               <xsl:value-of select="."/>
                               <xsl:if test="count(//ceanntásc/léirmheas/bibl/eagarthóir) &gt; 2">
                                   <xsl:if test="position() != last()-1 and position() != last()"><xsl:text>, </xsl:text></xsl:if>
                               </xsl:if>
                               <xsl:if test="count(//ceanntásc/léirmheas/bibl/eagarthóir) &gt; 1">
                                   <xsl:if test="position() = last()-1"><xsl:text> agus </xsl:text></xsl:if>
                               </xsl:if>
                            </xsl:for-each>
                            <xsl:choose> 
                                <xsl:when test="count(eagarthóir) &gt; 1"><xsl:text> (eagí)</xsl:text></xsl:when>
                                <xsl:otherwise><xsl:text> (eag.)</xsl:text></xsl:otherwise>
                            </xsl:choose> 
                        </reviewObjectEds>
                    </xsl:if>
                    <xsl:if test="aistritheoir">
                        <reviewObjectTrans>
                            <xsl:for-each select="aistritheoir/duine">
                               <xsl:value-of select="."/>
                               <xsl:if test="count(//ceanntásc/léirmheas/bibl/aistritheoir) &gt; 2">
                                   <xsl:if test="position() != last()-1 and position() != last()"><xsl:text>, </xsl:text></xsl:if>
                               </xsl:if>
                               <xsl:if test="count(//ceanntásc/léirmheas/bibl/aistritheoir) &gt; 1">
                                   <xsl:if test="position() = last()-1"><xsl:text> agus </xsl:text></xsl:if>
                               </xsl:if>
                            </xsl:for-each>
                            <xsl:text> (aist.)</xsl:text>
                            <xsl:text>&#13;</xsl:text>
                        </reviewObjectTrans>
                    </xsl:if>
                    <reviewDetails><xsl:for-each select="foilsitheoir"><xsl:apply-templates /></xsl:for-each> (<xsl:value-of select="dáta" />) <xsl:if test="leathanaigh"> | <xsl:value-of select="leathanaigh" /> lch</xsl:if><xsl:if test="ISBN"> | ISBN: <xsl:value-of select="ISBN" /></xsl:if><xsl:if test="praghas"> | <xsl:value-of select="praghas" /></xsl:if></reviewDetails>
                </reviewObject>
            </xsl:for-each>
        </reviewObjects>
    </xsl:if>
</xsl:template>
    
<xsl:template match="corpAilt/léirmheastóirí">
    <reviewerDesc>
        <xsl:for-each select="p"><reviewDescPara><xsl:apply-templates /><xsl:text>&#13;</xsl:text></reviewDescPara><xsl:text>&#13;</xsl:text></xsl:for-each>
    </reviewerDesc>
</xsl:template>
    
    
<!--figiúir-->
<xsl:template match="ionchódú">
    <images>
        <xsl:for-each select="//grafaic[@cuspóir='large-2x']">
            <xsl:element name="img">
                <xsl:attribute name="href">file://assets/<xsl:value-of select="@url"/></xsl:attribute>
            </xsl:element>
        </xsl:for-each>
    </images>
</xsl:template>

<xsl:template match="grafaic"/>
    
<xsl:template match="figiúr">
    <xsl:apply-templates/>
</xsl:template>
    
<xsl:template match="//figiúr/curSíos|//fuaim/curSíos">
    <figDesc><xsl:apply-templates/><xsl:text>&#13;</xsl:text></figDesc>
</xsl:template>
   
<xsl:template match="//curSíos//teideal|//curSíos//béim|//curSíos//codeSwitch|//curSíos//iasacht">
    <figDescItalics><xsl:value-of select="@url"/></figDescItalics>
</xsl:template>
    
    
<!--ilmheáin-->
<!--<xsl:template match="multimedia[@type='audio']">
    <multimediaInfo>
        <multimediaHead>Ábhar Ilmheán<xsl:text>&#13;</xsl:text></multimediaHead><xsl:text>&#13;</xsl:text>
        <multimediaPara><xsl:text>Is féidir éisteacht le mír fuaime a bhaineann leis an téacs seo ach cuairt a thabhairt ar an leagan ar líne den alt:</xsl:text><xsl:text>&#13;</xsl:text></multimediaPara><xsl:text>&#13;</xsl:text>
        <multimediaLink><xsl:text>http://www.comhartaighde.com/eagrain/</xsl:text><xsl:value-of select="//eagrán/@uimh"/><xsl:text>/</xsl:text><xsl:value-of select="//aitheantóir"/><xsl:text>/</xsl:text><xsl:text>&#13;</xsl:text></multimediaLink><xsl:text>&#13;</xsl:text>
    </multimediaInfo><xsl:text>&#13;</xsl:text>
</xsl:template>-->

    
<!--iarnótaí-->
<xsl:template match="ref[@type='endnote']">
    <endRef><xsl:apply-templates/></endRef>
</xsl:template>    
    
<xsl:template match="//div[@type='endnotes']">
    <notesHead>Iarnótaí<xsl:text>&#xa;</xsl:text></notesHead>
    <xsl:text>&#xa;</xsl:text>
    <xsl:for-each select="//div[@type='endnotes']/note">
        <note>
            <sup><xsl:number/></sup>
            <xsl:text> </xsl:text>
            <xsl:apply-templates/>
            <xsl:text>&#xa;</xsl:text>
        </note>
    <xsl:text>&#xa;</xsl:text>
    </xsl:for-each>
</xsl:template>
    
    
<!--leabharliosta-->
<xsl:template match="tagairtí/liostaBibl">
    <xsl:apply-templates/><xsl:text>&#13;</xsl:text>
</xsl:template>
    
<xsl:template match="tagairtí//bibl">
    <bibl><xsl:apply-templates/><xsl:text>&#13;</xsl:text></bibl>
</xsl:template>
    
<xsl:template match="tagairtí//lonnaíocht">
    <settlement><xsl:apply-templates/><xsl:text>&#13;</xsl:text></settlement>
</xsl:template>
    
<xsl:template match="tagairtí//taisclann">
    <repository><xsl:apply-templates/><xsl:text>&#13;</xsl:text></repository>
</xsl:template>
    
<xsl:template match="tagairtí//lámhscríbhinn">
    <repository><xsl:apply-templates/><xsl:text>&#13;</xsl:text></repository>
</xsl:template>
    
<xsl:template match="tagairtí//lámhscríbhinn">
    <msDesc><xsl:apply-templates/><xsl:text>&#13;</xsl:text></msDesc>
</xsl:template>
    
<!--<xsl:template match="//tagairtí/liostaBibl[@cineál='lámhscríbhinní']/bibl/lámhscríbhinn[last()]">
    <msDesc><xsl:apply-templates/></msDesc>
</xsl:template>-->
    
<xsl:template match="tagairtí//monogr|analytic">
    <xsl:apply-templates/>
</xsl:template>
    
<xsl:template match="corp//údar|tagairtí//dáta|reprint|tagairtí//eagarthóir|tagairtí//pubPlace|tagairtí//foilsitheoir|biblScope|lámhscríbhinn">
    <xsl:apply-templates />
</xsl:template>
    
    
<!--nóid atá le cealú-->  
<xsl:template match="logainm|corp//duine">
    <xsl:value-of select="."/>
</xsl:template>
<!--<xsl:template match="tagairt[not(@type='endnote')]|logainm|corp//duine">
    <xsl:value-of select="."/>
</xsl:template>-->
    
    
<!--nuair atá aitreabúid le baint-->
<xsl:template match="@xml:lang"/>
<xsl:template match="@xml:id"/>
<xsl:template match="@sprioc"/>
<xsl:template match="@cineál"/>
<xsl:template match="@beathaisnéis"/>
<xsl:template match="@suíomh"/>
    
    
<!--inneachar atá le baint-->
<xsl:template match="*[@xml:lang='en']"/>
<xsl:template match="aitheantóir"/>
<xsl:template match="nuashonruithe"/>
<xsl:template match="fuaim"/>
<xsl:template match="tábla"/>
<xsl:template match="aguisín"/>
    
    
</xsl:stylesheet>