<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- DESCRIPTION: generates a plain text version of the TEI edition. -->
<!-- CREATED: 2004-06-06 -->

<xsl:output
	method="text"
	indent="no"
	encoding="ISO-8859-1"/>
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="bibl note"/>

<xsl:param name="timestamp"/>

<xsl:template match="/">###############################################################################
<xsl:apply-templates select="TEI.2/teiHeader"/>
<xsl:apply-templates select="id('deviations')"/>
#
# -----------------------------------------------------------------------------
<xsl:text>&#x000D;&#x000A;</xsl:text>
<xsl:text>&#x000D;&#x000A;</xsl:text>
<xsl:apply-templates select="TEI.2/text/body"/>
</xsl:template>
	
<xsl:template match="teiHeader"># THE GOTHIC BIBLE
# 
# Based on the edition of Wilhelm Streitberg (1919)
# 
# -----------------------------------------------------------------------------
# 
# Source: Die gotische Bibel: Herausgegeben von Wilhelm Streitberg. 
# (Germanische Bibliothek, 2. Abteilung, 3. Band) 1. Teil: Der gotische Text 
# und seine griechische Vorlage. Mit Einleitung, Lesarten und Quellennachweisen
# sowie den kleineren Denkmälern als Anhang. Heidelberg: Carl Winter, 1919.
# 
# Online edition provided by Project Wulfila (http://www.wulfila.be),
# University of Antwerp (Belgium); text scanned and edited by
# Robert Tannert, David Landau &amp; Tom De Herdt (1997, 1998).
# 
# This electronic edition may be used for academic or other non-commercial
# purposes. It is expected that, in accord with normal scholarly etiquette,
# use of the material will be acknowledged appropriately, i.e. stating the
# information above.
# 
# This file has been generated using XSLT from a TEI XML master document.
<xsl:if test="$timestamp"># Generated on <xsl:value-of select="$timestamp"/>.</xsl:if>
# 
# Contact: Tom De Herdt &lt;see http://www.wulfila.be/project/contact&gt;
#          or
#          Project Wulfila
#          c/o Prof. J. Van Loon
#          University of Antwerp
#          Faculty of Applied Economics
#          Department of International Business Communication
#          Prinsstraat 13
#          B-2000 Antwerp
#          Belgium
# 
# -----------------------------------------------------------------------------
#
# CONVENTIONS:
# 
# Angular brackets &lt; &gt; indicate additions to the text,
# square brackets [ ] indicate deletions,
# parenthesis ( ) indicates that certain chracters or words can not be 
# identified with complete certainty (italic text in Streitberg's edition).
# 
# Tilde ~ indicates assimilation, as in "jaþ~þan" (for "jah þan").
# Incipit and explicit are given verse number 0 and 255:
# e.g. Luke 1:0 [CA] Aiwaggeljo þairh Lukan anastodeiþ.
#      Romans 16:255 [A] Du Rumonim ustauh.
# 
# ABBREVIATIONS:
# 
# Mt             Matthew
# Jn             John
# Lk             Luke
# Mk             Mark
# Rom            Romans
# 1Cor           Corinthians I
# 2Cor           Corinthians II
# Eph            Ephesians
# Gal            Galatians
# Php            Philippians
# Col            Colossians
# 1Thess         Thessalonians I
# 2Thess         Thessalonians II
# 1Tim           Timothy I
# 2Tim           Timothy II
# Tit            Titus
# Phm            Philemon
# Neh            Nehemiah
# Sk             Skeireins
# Sign           Gothic Signatures
# Cal            Gothic Calendar
# 
# MANUSCRIPTS:
# 
# CA             Codex Argenteus
# A              Codex Ambrosianus A
# B              Codex Ambrosianus B
# C              Codex Ambrosianus C
# D              Codex Ambrosianus D
# E              Codex Ambrosianus E
# Car            Codex Carolinus<!--# Giss           Codex Gissensis # Taur           *Codex Taurinensis [see A]-->
# Lat5750        Codex Vaticanus Latinus 5750
# Naples         Naples Deed
# Arezzo         Arezzo Deed
# Speyer         *Speyer fragment [see CA]
#
</xsl:template>
<!-- NOTE: the information above should be extracted from the TEI header... -->

<!-- === DEVIATIONS =========================================================== -->
	<xsl:template match="id('deviations')"># DEVIATIONS FROM STREITBERG'S 1919 EDITION:
#
# <xsl:value-of select="p"/>
		<xsl:for-each select="list/item">
# <xsl:value-of select="cit/ref"/>: <xsl:apply-templates select="cit/quote"/><xsl:apply-templates select="note"/>
		</xsl:for-each>
	</xsl:template>
	<xsl:template match="item/cit/quote">
		<xsl:for-each select="hi">
			<xsl:apply-templates mode="SIC-form"/>
			<xsl:text> --&gt; </xsl:text>
			<xsl:apply-templates mode="CORR-form"/>
			<xsl:if test="not(position()=last())">, </xsl:if>
		</xsl:for-each>
	</xsl:template>
	<xsl:template match="corr" mode="SIC-form">
		<xsl:value-of select="@sic"/>
	</xsl:template>
	<xsl:template match="corr" mode="CORR-form">
		<xsl:value-of select="."/>
	</xsl:template>
	<xsl:template match="id('deviations')//note"> (<xsl:apply-templates/>)</xsl:template>
	<xsl:template match="id('deviations')//title">"<xsl:apply-templates/>"</xsl:template>
	<xsl:template match="id('deviations')//q">"<xsl:apply-templates/>"</xsl:template>
	<xsl:template match="id('deviations')//note/quote">"<xsl:apply-templates/>"</xsl:template>
<!-- ========================================================================== -->


	<xsl:template match="body">
		<xsl:apply-templates select="div/div/ab/app/rdg|div/opener/app/rdg|div/closer/app/rdg"/>
	</xsl:template>
			
	<xsl:template match="rdg">
		<xsl:variable name="book" select="../../../../@id"/>
		<xsl:variable name="bookname" select="id('books')/list/item[@corresp=$book]/expan/@abbr"/>
		<xsl:variable name="chapter" select="../../../@n"/>
		<xsl:variable name="verse" select="../../@n"/>
		<xsl:value-of select="concat($bookname, ' ', $chapter, ':', $verse, ' [', @wit, '] ')"/>
		<xsl:apply-templates/>
		<xsl:text>&#x000D;&#x000A;</xsl:text>
	</xsl:template>
	
	<xsl:template match="div/opener/app/rdg">
		<xsl:variable name="book" select="../../../@id"/>
		<xsl:variable name="bookname" select="id('books')/list/item[@corresp=$book]/expan/@abbr"/>
		<xsl:variable name="chapter" select="1"/>
		<xsl:variable name="verse" select="0"/>
		<xsl:value-of select="concat($bookname, ' ', $chapter, ':', $verse, ' [', @wit, '] ')"/>
		<xsl:apply-templates/>
		<xsl:text>&#x000D;&#x000A;</xsl:text>
	</xsl:template>
	
	<xsl:template match="div/closer/app/rdg">
		<xsl:variable name="book" select="../../../@id"/>
		<xsl:variable name="bookname" select="id('books')/list/item[@corresp=$book]/expan/@abbr"/>
		<xsl:variable name="chapter" select="../../../div[last()]/@n"/><!-- i.e. the chapter number of the last chapter in this book -->
		<xsl:variable name="verse" select="255"/>
		<xsl:value-of select="concat($bookname, ' ', $chapter, ':', $verse, ' [', @wit, '] ')"/>
		<xsl:apply-templates/>
		<xsl:text>&#x000D;&#x000A;</xsl:text>
	</xsl:template>
	
	<!-- TOKENS: -->
	<xsl:template match="seg"><xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if><xsl:apply-templates/></xsl:template>
	
	<!-- VARIATIONS: -->
	<xsl:template match="seg[@type='diff']"><xsl:if test="not(position()=1 or child::*[1][self::c])"><xsl:text> </xsl:text></xsl:if><xsl:apply-templates/></xsl:template>
	
	<!-- PUNCTUATION: -->
	<xsl:template match="c"><xsl:value-of select="."/></xsl:template>
	<xsl:template match="c[text()='&#x2014;']"><xsl:text> </xsl:text>-</xsl:template>
	
	<!-- ADDITIONS: -->
	<xsl:template match="add"><!-- containing one or more tokens: -->
		<xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if>
		<xsl:text>&lt;</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>&gt;</xsl:text>
	</xsl:template>
	<xsl:template match="seg[not(@type)]/add"><!-- contained within a token: -->
		<xsl:text>&lt;</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>&gt;</xsl:text>
	</xsl:template>
	
	<!-- DELETIONS: -->
	<xsl:template match="del"><!-- containing one or more tokens: -->
		<xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if>
		<xsl:text>[</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>]</xsl:text>
	</xsl:template>
	<xsl:template match="seg[not(@type)]/del"><!-- contained within a token: -->
		<xsl:text>[</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>]</xsl:text>
	</xsl:template>
	
	<!-- UNCLEAR TEXT: -->
	<xsl:template match="unclear"><!-- always contained within a token (fragmentation): -->
		<xsl:text>(</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>)</xsl:text>
	</xsl:template>
		
	<!-- LACUNAE: -->
	<xsl:template match="lacunaStart|lacunaEnd|gap"><xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if>. . . .</xsl:template>
	
	<!-- NUMBERS: --> 
	<xsl:template match="num">
		<xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if>
		<xsl:apply-templates/>
		<xsl:text> (</xsl:text>
		<xsl:value-of select="@value"/>
		<xsl:text>)</xsl:text>
	</xsl:template>

	<!-- QUOTATIONS: -->
	<xsl:template match="quote">
		<xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if>
		<xsl:text>"</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>"</xsl:text>
	</xsl:template>
	<xsl:template match="q">
		<xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if>
		<xsl:text>'</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>'</xsl:text>
	</xsl:template>

</xsl:stylesheet>
