<?xml version="1.0" encoding="UTF-8"?>
<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 omit-xml-declaration="yes" indent="yes" encoding="UTF-8" />


<xsl:include href="_variables.xsl" />     
    
<xsl:template match="tei:title">
    <title><xsl:value-of select="."/></title>
</xsl:template>
    
<xsl:template match="tei:foreign|tei:emph">
    <i><xsl:value-of select="."/></i>
</xsl:template>
    
<xsl:template match="tei:titleStmt/tei:title">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="/">
<xsl:element name="article">
    <xsl:attribute name="identifier">
        <xsl:value-of select="tei:TEI/tei:teiHeader/tei:fileDesc/ct:identifier"/>
    </xsl:attribute>
    <xsl:attribute name="article_type">
        <xsl:value-of select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/ct:articleType[@xml:lang='ga']"/>
    </xsl:attribute>
    <xsl:attribute name="sequence"><xsl:value-of select="tei:TEI/tei:teiHeader/tei:fileDesc/ct:sequence"/></xsl:attribute>
    <title><xsl:apply-templates select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@xml:lang='ga']"/></title>
    <authors><xsl:copy-of select="$authorNames"/></authors>
</xsl:element>
</xsl:template>
    
</xsl:stylesheet>