<?xml version="1.0" encoding="UTF-8"?>

<!-- 
    Project: Moralische Wochenschriften, Institut für Romanistik
    Company: ZIM:IG (Zentrum für Informationsmodellierung in den Geisteswissenschaften)
    Author: Martina Semlak
    Last update: 08-08-2012   
-->


<!-- FIXME: Schriftgröße -->
<!-- FIXME: Navigation: Home, About, Impressum -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:bibtex="http://bibtexml.sf.net/"
    xmlns="http://www.w3.org/1999/xhtml"  xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" 
    xmlns:i18n="http://apache.org/cocoon/i18n/2.1" xmlns:t="http://www.tei-c.org/ns/1.0" 
    xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:oai="http://www.openarchives.org/OAI/2.0/" exclude-result-prefixes="bibtex s t dc oai_dc">
    
<xsl:output
        method="xml"
        doctype-system="about:legacy-compat"
        encoding="UTF-8"
        indent="yes" />
        
        <script type="text/javascript" src="/scripts/moment-with-locales.js"><xsl:text>//</xsl:text></script>
   
	
	<xsl:include href="3mws-static.xsl"/>
	    
    <xsl:variable name="idno">
        <xsl:choose>
            <xsl:when test="contains(//t:idno, 'info:fedora')">
                <xsl:value-of select="substring-after(//t:idno, '/')" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="//t:idno" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
  
  
   <xsl:variable name="handle">
        <xsl:value-of
            select="document(concat('/archive/objects/', $idno, '/datastreams/RELS-EXT/content'))//rdf:RDF/rdf:Description/oai:itemID"
        />
    </xsl:variable>
      
     <xsl:variable name="vLowest">
        <xsl:for-each select="//t:pb/@n">
            <xsl:sort data-type="number"/>
            <xsl:if test="position() = 1">
                <xsl:value-of select="."/>
            </xsl:if>
        </xsl:for-each>
    </xsl:variable>
    <xsl:variable name="vHighest">
        <xsl:for-each select="//t:pb/@n">
            <xsl:sort data-type="number"/>
            <xsl:if test="position() = last()">
                <xsl:value-of select="."/>
            </xsl:if>
        </xsl:for-each>
    </xsl:variable>
    
    
    
 
    <xsl:template name="content">
        
            
        <xsl:if test="$mode='original' or $mode='' and not(/bibtex:file)">
	        <section class="ym-grid linearize-level-1 ym-equalize">
	            <article class="ym-g66 ym-gl content">
	                <div class="ym-gbox-left ym-clearfix">
	    <div id="content1">
	    <!-- 
	        <xsl:if test="string-length(//t:bibl/t:title) > 1">
	            <p style="font-size: 0.85em; padding-top: 0.5em; padding-bottom: 0; margin-bottom: 0;"><xsl:value-of select="//t:bibl/t:title" />: <xsl:value-of select="//t:titleStmt/t:title" /></p>
	        </xsl:if>
	         -->
	        <xsl:if test="not(/s:sparql/s:results/s:result) and not(/t:TEI) and not(/bibtex:file)">
	            <div id="display">
	                <p class="no-results">
	                    <i18n:text>entries</i18n:text>
	                </p>
	            </div>
	        </xsl:if>
	        
	        <xsl:if test="//t:facsimile">
	            <p style="font-size: 0.85em; padding-top: 0.5em; padding-bottom: 0; margin-bottom: 0; text-align:right">
	            	<a href="/viewer/viewer.html?mets=https://gams.uni-graz.at/cocoon/mets2json?source=https%3A%2F%2Fgams.uni-graz.at%2Farchive%2Fget%2F{$idno}%2FMETS_SOURCE">
	            	<i18n:text>Faksimile anzeigen</i18n:text></a>
	            </p>
	        </xsl:if>
	        
	         <xsl:if test="string-length(//t:bibl/t:title) > 1">

                            <p
                                style="font-size: 0.8em; padding-top: 0.4em; padding-bottom: 0; margin-bottom: 0;"
                                        ><strong><i18n:text>Zitiervorschlag</i18n:text>:</strong>
                                <xsl:text> </xsl:text><xsl:value-of select="//t:titleStmt/t:author"/> (<i18n:text>Hrsg.</i18n:text>): "<xsl:value-of
                                    select="//t:titleStmt/t:title"/>", <i18n:text>in</i18n:text>:
                                        <em><xsl:value-of select="//t:sourceDesc/t:bibl/t:title"
                                    /></em><xsl:text>, Vol.</xsl:text>
                                    
                                    <xsl:choose>
                                    	<xsl:when test="//t:sourceDesc/t:bibl/t:biblScope[@unit = 'volume']">
                                    		<xsl:value-of
                                    select="//t:sourceDesc/t:bibl/t:biblScope[@unit = 'volume']"
                                    /><xsl:text>\</xsl:text><xsl:value-of
                                    select="//t:sourceDesc/t:bibl/t:biblScope[@unit = 'issue']"/>
                                    	</xsl:when>
                                    	<xsl:otherwise>
                                    		<xsl:value-of
                                    select="//t:sourceDesc/t:bibl/t:biblScope[@type = 'vol']"
                                    /><xsl:text>\</xsl:text><xsl:value-of
                                    select="//t:sourceDesc/t:bibl/t:biblScope[@type = 'issue']"/>	
                                    	</xsl:otherwise>
                                    </xsl:choose>
                                    
                                    
                                <xsl:text> (</xsl:text><xsl:value-of
                                    select="//t:sourceDesc/t:bibl/t:date"/>)<xsl:if
                                    test="//t:text//t:body//t:pb">, <i18n:text>S.</i18n:text><xsl:text> </xsl:text>
                                    <xsl:choose>
                                     <xsl:when test="//t:TEI/t:facsimile">
                                      <xsl:value-of select="$vLowest"/>-<xsl:value-of select="$vHighest"/>
                                     </xsl:when>
                                     <xsl:otherwise>
                                      <xsl:value-of select="$vLowest -1"/>-<xsl:value-of select="$vHighest"/>
                                      <!-- 1.pb minus 1 bis letzter PB -->
                                      </xsl:otherwise>
                                      </xsl:choose>
                                </xsl:if>, <i18n:text>ediert in</i18n:text>:
                                
                                <xsl:choose>
                                	<xsl:when test="//t:respStmt[1]/t:resp='Herausgeber'">
                                		<xsl:for-each select="//t:respStmt[t:resp='Herausgeber']/t:name">
                                			<xsl:value-of select="concat(substring-after(., ' '), ', ', substring-before(., ' '))" />
                                			<xsl:if test="not(position()=last())">
                                				<xsl:text> / </xsl:text>
                                			</xsl:if>
                                		</xsl:for-each>
                                	</xsl:when>
                                	<xsl:otherwise>
                                	<xsl:text>Ertler, Klaus-Dieter</xsl:text>
                                
                                    <xsl:if test="//t:language[@ident = 'es']"
                                    ><xsl:text> / Hobisch, Elisabeth</xsl:text></xsl:if>
                                <xsl:if test="//t:langUsage/t:language[@ident = 'fr']"> / Fischer-Pernkopf,
                                    Michaela</xsl:if>
                                <xsl:if test="//t:langUsage/t:language[@ident = 'it']">
                                   <xsl:choose>
                                        <xsl:when test="//t:respStmt/t:name[contains(.,'Kirsten Dickhaut')]"
                                            ><xsl:text> / Dickhaut, Kirsten / Fuchs, Alexandra</xsl:text></xsl:when>
                                        <xsl:when
                                            test="//t:respStmt/t:name[contains(., 'Angela Fabris')]"
                                            ><xsl:text> / Fabris, Angela / Fuchs, Alexandra</xsl:text></xsl:when>
                                        <xsl:otherwise>
                                        	<xsl:text> / Fuchs, Alexandra</xsl:text>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </xsl:if>
                                <xsl:if test="//t:langUsage/t:language[@ident = 'en']"> / Fuchs,
                                        Alexandra</xsl:if>
                                        
                                <xsl:if test="//t:sourceDesc//t:bibl[@xml:id = 'ZUS']"> / Fuchs, Alexandra</xsl:if>
								<xsl:if test="//t:sourceDesc//t:bibl[@xml:id = 'MZUS']"> / Fuchs,  Alexandra</xsl:if>
                                    
								<xsl:if test="//t:sourceDesc//t:bibl[@xml:id = 'LSP']"> / Doms, Misia Sophia / Hahne, Nina</xsl:if>
								<xsl:if test="//t:sourceDesc//t:bibl[@xml:id = 'BUER']"> / Doms, Misia Sophia / Hahne, Nina</xsl:if>
                                
                                	</xsl:otherwise>
                                </xsl:choose>
                                
                               
                                 (<i18n:text>Hrsg.</i18n:text>):
                                    <i18n:text>Spectators</i18n:text>. <i18n:text>Digitale Edition</i18n:text>, Graz 2011-<span id="displayYear"
                                    ><xsl:text> </xsl:text></span>. <xsl:choose>
                                    <xsl:when test="string-length($handle) = 0"
                                            >https://gams.uni-graz.at/<xsl:value-of select="$idno"/>
                                            [<i18n:text>aufgerufen am</i18n:text>: <span
                                            id="displayDate"><xsl:text> </xsl:text></span>]. </xsl:when>
                                    <xsl:otherwise> hdl.handle.net/<xsl:value-of
                                            select="substring-after($handle, 'hdl:')"/>
                                            [<i18n:text>aufgerufen am</i18n:text>: <span
                                            id="displayDate"><xsl:text> </xsl:text></span>].
                                    </xsl:otherwise>
                                </xsl:choose>
                            </p>
                        </xsl:if>

                       
 <script type="text/javascript">
                        (function()
                        {
                        
                        moment.locale('de');
                        var NowMoment = moment().format('L');
                        var NowYear = moment().format('YYYY');
                        
                        // display value of moment object in #displayMoment div
                        var eDisplayMoment = document.getElementById('displayDate');
                        eDisplayMoment.innerHTML = NowMoment;
                        
                        var eDisplayYear = document.getElementById('displayYear');
                        eDisplayYear.innerHTML = NowYear;
                        })();
                        
                    </script>


                        <xsl:if
                            test="not(/s:sparql/s:results/s:result) and not(/t:TEI) and not(/bibtex:file)">
                            <div id="display">
                                <p class="no-results">
                                    <i18n:text>entries</i18n:text>
                                </p>
                            </div>
                        </xsl:if>

                        <!--<ul id="ressourcen">


                            <li style="list-style-type: none; display:inline; float:right;">
                                <!-\- normales PDF -\->
                                <a>
                                    <xsl:attribute name="href">
                                        <xsl:text>/archive/objects/</xsl:text>
                                        <xsl:value-of select="$idno"/>
                                        <xsl:text>/methods/sdef:TEI/getPDF?locale=</xsl:text>
                                        <xsl:value-of select="$locale"/>
                                        <xsl:text>&amp;mode=original</xsl:text>
                                    </xsl:attribute>
                                    <img src="/img/icon_PDF.png" width="30"
                                        height="30" alt="Print version (original view)"/>
                                    <!-\- wie kann ich in der Beschreibung das i18n-text-Ding verwenden? -\->
                                </a>
                            </li>

                            <li style="list-style-type: none; display:inline; float:right;">
                                <!-\- TEI (P5) -\->
                                <a>
                                    <xsl:attribute name="href">
                                        <xsl:text>/archive/objects/</xsl:text>
                                        <xsl:value-of select="$idno"/>
                                        <xsl:text>/datastreams/TEI_SOURCE/content</xsl:text>
                                    </xsl:attribute>
                                    <img src="/img/TEI-600.jpg" width="30"
                                        height="30" alt="XML (TEI P5)"/>
                                </a>
                            </li>
                        </ul>-->
<hr />

                  <!--      <xsl:if test="/t:TEI">
                            <div id="display">
                                <div id="text">
                                    <xsl:apply-templates select="//t:text[@ana = 'layout']/t:body"/>
                                </div>
                            </div>

                        </xsl:if>
 -->



                       <!--  <h3 class="objekt">
                            <xsl:value-of select="//t:title"/>
                        </h3>
                    </xsl:if>
	    -->
	        
	        
	   
	        
	        <xsl:if test="/t:TEI">    
	                    <div id="display">
	                   <!--     <p class="back"><a href="javascript:history.go(-1)">«
	                            <i18n:text>back</i18n:text></a> | <a><xsl:attribute
	                                name="href">
	                                <xsl:text>/archive/objects/</xsl:text>
	                                <xsl:value-of select="$idno"/>
	                                <xsl:text>/methods/sdef:TEI/get?locale=</xsl:text>
	                                <xsl:value-of select="$locale" />
	                                <xsl:text>&amp;mode=analyse&amp;context=</xsl:text>
	                            </xsl:attribute>
	                            <i18n:text>visofanalysis</i18n:text></a></p>
	                        <div>
	                            <form id="selector1" action="">
	                                <input type="checkbox" name="show" value="seiten"/>
	                                <xsl:text> </xsl:text>
	                                <i18n:text>origpag</i18n:text>
	                                <br/>
	                                <input type="checkbox" name="show" value="ebenen"/>
	                                <xsl:text> </xsl:text>
	                                <i18n:text>repandnarr</i18n:text>
	                            </form>
	                        </div>-->
	                        <div id="text">
	                            <xsl:apply-templates select="//t:text[@ana='layout']/t:body"/>
	                        </div>
	                    </div>
	            
	        </xsl:if>
	        
	        
	        
	    </div>
	                </div>
	            </article>
	        
	            <aside class="ym-g33 ym-gr">
	                <div class="ym-gbox-right ym-clearfix">
	                  <div class="sticky" style="margin-top: 0;">
	                         <!--<li style="list-style: none;">
	                             <xsl:choose>
	                                 <xsl:when test="$context">
	                                     <a>
	                                         <xsl:attribute name="href">
	                                             <xsl:text>/archive/objects/</xsl:text>
	                                             <xsl:value-of select="substring-after($context, ';')" />
	                                             <xsl:text>/methods/sdef:Context/get?locale=</xsl:text>
	                                             <xsl:value-of select="$locale" />
	                                             <xsl:text>&amp;context=</xsl:text>
	                                             <xsl:value-of select="substring-before($context, ';')" />
	                                         </xsl:attribute> 
	                                         <i18n:text>back to context</i18n:text>
	                                     </a>
	                                 </xsl:when>
	                                 <xsl:otherwise>
	                                     <a href="javascript:history.back()">
	                                         <i18n:text>back to context</i18n:text>
	                                     </a>
	                                 </xsl:otherwise>
	                             </xsl:choose>
	                             
	                         </li>-->
	                      <ul id="downloads" style="margin-left: 0em;">
	                          <span style="text-decoration: underline; display:flex; align-items:center; margin-bottom:2px"> <img src="/mws/img/icon_download.png" width="22" height="22" style="margin-right:2px;" alt="Downloads"/>
	                        <i18n:text>Downloads</i18n:text> </span>
				 <li style="list-style: none;">
	                                 <a>
	                                     <xsl:attribute name="href">
	                                         <xsl:text>/archive/objects/</xsl:text>
	                                         <xsl:value-of select="$idno"/>
	                                         <xsl:text>/datastreams/TEI_SOURCE/content</xsl:text>
	                                     </xsl:attribute>
	                                     <xsl:text>XML (TEI P5)</xsl:text>
	                                 </a>
	                             </li>
	                         <li style="list-style: none;">
	                             <a>
	                                 <xsl:attribute name="href">
	                                     <xsl:text>/archive/objects/</xsl:text>
	                                     <xsl:value-of select="$idno" />
	                                     <xsl:text>/methods/sdef:TEI/getPDF?locale=</xsl:text>
	                                     <xsl:value-of select="$locale" />
	                                     <xsl:text>&amp;mode=original</xsl:text>
	                                 </xsl:attribute>
	                                 <xsl:text>PDF </xsl:text>
	                                 <i18n:text>Print version (original view)</i18n:text>
	                             </a>
	                         </li>
	                         <li style="list-style: none;">
	                             <a>
	                                 <xsl:attribute name="href">
	                                     <xsl:text>/archive/objects/</xsl:text>
	                                     <xsl:value-of select="$idno" />
	                                     <xsl:text>/methods/sdef:TEI/getPDF?locale=</xsl:text>
	                                     <xsl:value-of select="$locale" />
	                                     <xsl:text>&amp;mode=analyse</xsl:text>
	                                 </xsl:attribute>
					<xsl:text>PDF </xsl:text>
	                                 <i18n:text>Print version (analytical view)</i18n:text>
	                                 
	                             </a>
	                         </li>
	                         </ul>
	                      <ul id="views" style="margin-left: 0em; margin-bottom:2px">
				<span style="text-decoration: underline"><i18n:text>Views</i18n:text></span>
	                          <li style="list-style: none;">	                              <a>
	                                  <xsl:attribute name="href">
	                                      <xsl:text>/archive/objects/</xsl:text>
	                                      <xsl:value-of select="$idno"/>
	                                      <xsl:text>/methods/sdef:TEI/get?locale=</xsl:text>
	                                      <xsl:value-of select="$locale" />
	                                      <xsl:text>&amp;mode=analyse&amp;context=</xsl:text>
	                                      <xsl:value-of select="$context" />
	                                  </xsl:attribute>
	                                  <i18n:text>visofanalysis</i18n:text></a>
	                          </li> 
	                         <li style="list-style: none;">
	                             <a>
	                                 <xsl:attribute name="href">
	                                     <xsl:text>http://voyant-tools.org/?input=https://gams.uni-graz.at/archive/objects/</xsl:text>
	                                     <xsl:value-of select="$idno"/>
	                                     <xsl:text>/datastreams/TEI_SOURCE/content</xsl:text>
	                                 </xsl:attribute>
	                                 <xsl:text>Voyant Tools</xsl:text>
	                             </a>
	                         </li>
	                         
	                         
	                        
	                         <li style="list-style: none;">
	                            <form id="selector1" action="" style="margin-top: 1em;">
	                                <input type="checkbox" name="show" value="seiten" />
	                                <xsl:text> </xsl:text>
	                                <i18n:text>origpag</i18n:text>
	                                <br/>
	                                <input type="checkbox" name="show" value="ebenen" />
	                                <xsl:text> </xsl:text>
	                                <i18n:text>repandnarr</i18n:text>
	                                
	                                
	                                <xsl:if test="//t:text//t:placeName">
	                                    <br />
	                                    <input type="checkbox" name="show" value="place">
	                                       <!-- <xsl:if test="not(//t:text//t:placeName)">
	                                            <xsl:attribute name="disabled">
	                                                <xsl:text>disabled</xsl:text>
	                                            </xsl:attribute>
	                                        </xsl:if>-->
	                                    </input>
	                                    <xsl:text> </xsl:text>
	                                    <span>
	                                        <i18n:text>Places</i18n:text>
	                                    </span>
	                                </xsl:if>
	                                
	                                <xsl:if test="//t:text//t:persName">
	                                    <br />
	                                    <input type="checkbox" name="show" value="person">
	                                        <!--<xsl:if test="not(//t:persName)">
	                                            <xsl:attribute name="disabled">
	                                                <xsl:text>disabled</xsl:text>
	                                            </xsl:attribute>
	                                        </xsl:if>-->
	                                    </input>
	                                    <xsl:text> </xsl:text>
	                                    <span>
	                                        <i18n:text>People</i18n:text>
	                                    </span>
	                                </xsl:if>
	                                
	                                <xsl:if test="//t:text//t:name[@type='work']">
	                                <br />
	                                <input type="checkbox" name="show" value="work">
	                                	<!--<xsl:if test="not(//t:name[@type='work'])">
	                                		<xsl:attribute name="disabled">
	                                			<xsl:text>disabled</xsl:text>
	                                		</xsl:attribute>
	                                	</xsl:if>-->
	                                </input>
	                                <xsl:text> </xsl:text>
	                                <span>
	                                <i18n:text>Writings</i18n:text>
	                                </span>
	                               </xsl:if>
	                                
	                                
	                            </form>
	                        </li>
	                        
	                        
	                    </ul>
	                    </div>
	                </div>
	            </aside>
	        </section>
	    
            
            
	    </xsl:if>
                    
                    
                    <xsl:if test="$mode='analyse'">
                        
                        <section class="ym-grid linearize-level-1 ym-equalize">
                            <article class="ym-g66 ym-gl content">
                                <div class="ym-gbox-left ym-clearfix">
                        
                        
                    
                        
                         <div id="analyse">
                             <xsl:if test="string-length(//t:bibl/t:title) > 1">
                                 <p style="font-size: 0.85em; padding-top: 0.5em; padding-bottom: 0; margin-bottom: 0;"><xsl:value-of select="//t:bibl/t:title" />: <xsl:value-of select="//t:titleStmt/t:title" /></p>
                             </xsl:if>
                            <p style="font-size: 0.85em; padding-top: 0; margin-top: 0;">Permalink: https://gams.uni-graz.at/<xsl:value-of select="$idno" /></p>
                            <div id="framing">
                                
                                <xsl:apply-templates select="//t:text[@ana='framings']/t:body/t:div/t:ab" />
                            </div>
                            <div class="fn">
                                <xsl:text> </xsl:text>
                                <xsl:call-template name="fn-a" />
                            </div>
                        </div>
                        
                        
                  
                               
                                </div>
                                
                                </article>
                                
                        
                        
                        
                        <aside class="ym-g33 ym-gr">
                            <div class="ym-gbox-right ym-clearfix"  style="margin-top: 0em;">
                            <div class="sticky" style="margin-top: 0;">
                               
                                <ul style="margin-left: 0em; margin-bottom: 1em;">
                                    <li style="list-style: none;">
                                        <a>
                                            <xsl:attribute name="href">
                                                <xsl:text>/archive/objects/</xsl:text>
                                                <xsl:value-of select="$idno"/>
                                                <xsl:text>/methods/sdef:TEI/get?locale=</xsl:text>
                                                <xsl:value-of select="$locale" />
                                                <xsl:text>&amp;mode=original&amp;context=</xsl:text>
                                                <xsl:value-of select="$context" />
                                            </xsl:attribute>
                                            <i18n:text>origaspect</i18n:text>
                                        </a>
                                    </li>
                                    
                                    <li style="list-style: none;">
                                        <a>
                                            <xsl:attribute name="href">
                                                <xsl:text>/archive/objects/</xsl:text>
                                                <xsl:value-of select="$idno" />
                                                <xsl:text>/methods/sdef:TEI/getPDF?locale=</xsl:text>
                                                <xsl:value-of select="$locale" />
                                                <xsl:text>&amp;mode=analyse</xsl:text>
                                            </xsl:attribute>
                                            <i18n:text>Print version (analytical view)</i18n:text>
                                            
                                        </a>
                                    </li>
                                    
                                </ul>
                                
                                
                                <form class="all" style="margin-left: 1em;">
                                        <input type="checkbox" id="show" class="einblenden" name="show" value="ein-/ausblenden" /><xsl:text> </xsl:text><span style="font-size: 0.85em;"><i18n:text>visalltexts</i18n:text></span><br/>
                                    </form>
                                    <xsl:apply-templates select="//t:interpGrp" />
                                
                                
                                
                        </div>
                        
                            </div>
                    
                    </aside>
                  
                            </section>
                            
                    </xsl:if>
        
        <!-- FIXME: diesen Teil in 3mws-static.xsl auslagern - mit 3mws-context.xsl zusammenlegen -->
        <xsl:if test="/bibtex:file">
                        <section class="ym-grid linearize-level-1 ym-equalize">
                    <article class="ym-g66 ym-gl content">
                        <div class="ym-gbox-left ym-clearfix">
                            
                            
            <div id="display">
                <xsl:apply-templates mode="bibliography" />         
            </div>     
            
             </div>
              
                    </article>
                    <aside class="ym-g33 ym-gr" style="overflow: hidden;">
                        
                        <div class="ym-gbox-right ym-clearfix" >
                            
                            <ul>
                                <li style="position: relative; z-index:2;">
                                    <a
                                        href="/archive/objects/context:mws/methods/sdef:Context/get?mode=about">
                                        <i18n:text>Projektbeschreibung</i18n:text>
                                    </a>
                                </li>
                                <li style="position: relative; z-index:2;">
                                    <a
                                        href="/archive/objects/container:mws-bibliographie/methods/sdef:Context/get?locale={$lang}&amp;mode=bibl&amp;context=">
                                        <i18n:text>bibliography</i18n:text>
                                    </a>
                                </li>
                            </ul>
                            <div>
                                <div id="map-europe" style="z-index: 1;">
                                    <ul class="europe">
                                        <li class="eu13" style="text-transform: uppercase;">
                                            <a
                                                href="/archive/objects/container:mws-fr/methods/sdef:Context/get?locale={$lang}&amp;mode=&amp;context=fr">
                                                <i18n:text>france</i18n:text>
                                            </a>
                                        </li>
                                        <li class="eu22" style="text-transform: uppercase;">
                                            <a
                                                href="/archive/objects/container:mws-it/methods/sdef:Context/get?locale={$lang}&amp;mode=&amp;context=it">
                                                <i18n:text>italy</i18n:text>
                                            </a>
                                        </li>
                                        <li class="eu42" style="text-transform: uppercase;">
                                            <a
                                                href="/archive/objects/container:mws-es/methods/sdef:Context/get?locale={$lang}&amp;mode=&amp;context=sp">
                                                <i18n:text>spain</i18n:text>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <p style="clear: both; position: relative; top: 20em; z-index: 2;" 
                                ><i18n:text>Click to select a country</i18n:text></p>
                            </div>
                            </aside>    
            </section>
        </xsl:if>
                    
            </xsl:template>
    
    
    <!-- original start -->
    <xsl:template match="t:text[@ana='layout']/t:body">
        <xsl:apply-templates mode="original"/>
        <div class="fn">
            <xsl:text> </xsl:text>
            <xsl:call-template name="fn" />
        </div>
    </xsl:template>
    
    <xsl:template match="t:div1" mode="original">
        <xsl:apply-templates mode="original"/>
    </xsl:template>
    
    <xsl:template match="t:head" mode="original">
        <h1>
            <xsl:apply-templates mode="original"/>
        </h1>
    </xsl:template>
    
    <xsl:template match="t:div2/t:head" mode="original">
        <h2>
            <xsl:apply-templates mode="original"/>
        </h2>
    </xsl:template>
    
    <xsl:template match="t:div3/t:head" mode="original">
        <h3>
            <xsl:apply-templates mode="original"/>
        </h3>
    </xsl:template>
    
    <xsl:template match="t:lb" mode="original">
        <br/>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='AU']" mode="original">
        <h4 class="AU">
            <xsl:apply-templates mode="original"/>
        </h4>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='MO']" mode="original">
        <h4 class="M">
            <xsl:apply-templates mode="original"/>
        </h4>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='QU']" mode="original">
        <h4 class="QU">
            <xsl:apply-templates mode="original"/>
        </h4>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='UM']" mode="original">
        <h4 class="UM">
            <xsl:apply-templates mode="original"/>
        </h4>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='EU']" mode="original">
        <p class="EU">
            <xsl:apply-templates mode="original"/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='SO']" mode="original">
        <p>
            <xsl:apply-templates mode="original"/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='date']" mode="original">
        <p class="DT">
            <xsl:value-of select="."/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:p" mode="original">
        <p>
            <xsl:if test="not(following-sibling::t:p[1][@rend='EU'])">
                <xsl:attribute name="class">
                    <xsl:text>ST</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="following-sibling::t:p[1][@rend='EU']">
                <xsl:attribute name="class">
                    <xsl:text>ST last</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:apply-templates mode="original"/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:hi[@rend='italic']"  mode="original">
    		<xsl:choose>
    			<xsl:when test="string-length(.) > 1">
    				  <em>
                <xsl:apply-templates mode="original"/>
            </em>
    			</xsl:when>
    			<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
    		</xsl:choose>
          
    </xsl:template>
    
    <xsl:template match="t:hi[@rend='bold']"  mode="original">
            <strong>
                <xsl:apply-templates mode="original"/>
            </strong>
    </xsl:template>
    
    <xsl:template match="t:hi[@rend='smallcaps']" mode="original">
        <span class="smallcaps">
            <xsl:apply-templates mode="original"/>
        </span>
    </xsl:template>
    
    <xsl:template match="t:hi[@rend='superscript']" mode="original">
        <span class="superscript">
            <xsl:apply-templates mode="original"/>
        </span>
    </xsl:template>
    
    <xsl:template match="text()" mode="original">
        <xsl:variable name="bindestrich">
            <xsl:value-of select="substring(., string-length(.),  1)"/>
        </xsl:variable>
        <xsl:choose>
        

            <xsl:when test="$bindestrich='-' and following-sibling::node()[1][name()='pb']">
            	<xsl:value-of select="substring(., 1, string-length(.) -1)"/>
            </xsl:when> 
            
            <xsl:when test="$bindestrich=' ' and following-sibling::t:hi[@rend='superscript']">
                <xsl:value-of select="." />
            </xsl:when> 
            <xsl:otherwise>
                <xsl:value-of select="."/>
            </xsl:otherwise>
          
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='BU']" mode="original">
        <p class="BU">
            <xsl:apply-templates mode="original"/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='BA']" mode="original">
        <p class="BA">
            <xsl:apply-templates mode="original"/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:p[@rend='CI']" mode="original">
        <p class="CI">
            <xsl:apply-templates mode="original"/>
        </p>
    </xsl:template>
    
    <xsl:template match="t:milestone" mode="original">
        <xsl:choose>
            <xsl:when test="@rend='closer'">
                <span>
                	<xsl:attribute name="class">
                		<xsl:text>ebenen </xsl:text>
                		<xsl:value-of select="@unit"/>
                	</xsl:attribute>
                    <xsl:text>&#x25C0;</xsl:text>
                    <xsl:call-template name="unit" />
                </span>
            </xsl:when>
            <xsl:otherwise>
                <span>
                	<xsl:attribute name="class">
                		<xsl:text>ebenen </xsl:text>
                		<xsl:value-of select="@unit"/>
                	</xsl:attribute>
                    <xsl:call-template name="unit" />
                    <xsl:text>&#x25BA;</xsl:text>
                </span>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:apply-templates mode="original"/>
    </xsl:template>
    
    <xsl:template name="unit">
    	<xsl:if test="@unit='E1'">
    		<i18n:text>Ebene 1</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='E2'">
    		<i18n:text>Ebene 2</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='E3'">
    		<i18n:text>Ebene 3</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='E4'">
    		<i18n:text>Ebene 4</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='E5'">
    		<i18n:text>Ebene 5</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='E6'">
    		<i18n:text>Ebene 6</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='AL'">
    		<i18n:text>Allegorie</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='AE'">
    		<i18n:text>Allgemeine Erzählung</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='D'">
    		<i18n:text>Dialog</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='EX'">
    		<i18n:text>Exemplum</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='F'">
    		<i18n:text>Fabel</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='FP'">
    		<i18n:text>Fremdportrait</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='LB'">
    		<i18n:text>Leserbrief</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='MT'">
    		<i18n:text>Metatextualität</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='S'">
    		<i18n:text>Satire</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='SP'">
    		<i18n:text>Selbstportrait</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='TR'">
    		<i18n:text>Traum</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='UT'">
    		<i18n:text>Utopie</i18n:text>
    	</xsl:if>
    	<xsl:if test="@unit='ZM'">
    		<i18n:text>Zitat/Motto</i18n:text>
    	</xsl:if>
    </xsl:template>
    
    <xsl:template match="t:pb" mode="original">
        <xsl:variable name="bindestrich">
            <xsl:value-of
                select="substring(preceding-sibling::text()[1],string-length(preceding-sibling::text()[1]),1)"
            />
        </xsl:variable>
        
        <span class="seiten">
            <xsl:choose>
                <xsl:when test="$bindestrich='-'">
                    <xsl:text>-</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text> </xsl:text>
                </xsl:otherwise>
            </xsl:choose>
            <xsl:text>[</xsl:text>
                <span class="markSeiten">
                    <xsl:value-of select="@n"/>
                </span>
            <xsl:text>]</xsl:text>
            <xsl:choose>
                <xsl:when test="$bindestrich='-'">
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text> </xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </span>
    </xsl:template>
    
    
    
    <xsl:template match="t:lg" mode="original">
        <div class="list-A1">
            <xsl:apply-templates mode="original"/>
        </div>
    </xsl:template>
    
    <xsl:template match="t:l" mode="original">
        <xsl:if test="@rend='GF'">
            <p class="GF">
                <xsl:apply-templates mode="original"/>
            </p>
        </xsl:if>
        <xsl:if test="@rend='G1'">
            <p class="G1">
                <xsl:apply-templates mode="original"/>
            </p>
        </xsl:if>
    </xsl:template>
    
    
    <!-- FIXME: wie soll Liste tatsächlich ausgegeben werden? -->
    <xsl:template match="t:list" mode="original">
        <ol style="margin-left: 1em; list-style-type: none;">
        
        	<xsl:for-each select="t:item">
    			<li>
    					<span style="float: left; text-align: right;"><xsl:apply-templates select="preceding-sibling::t:label[1]" mode="original" /><xsl:text>&#x00A0;</xsl:text></span>
    					<p style="padding-left: 1em; margin-left: 1.5em;"><xsl:apply-templates mode="original" /></p>
    			</li>	    
           
 			</xsl:for-each>
 			
 		</ol>
    </xsl:template>
    
    <xsl:template match="t:label" mode="original">
    	<xsl:apply-templates mode="original" />
    </xsl:template>
    
    <xsl:template match="t:note" mode="original">
        <a id="n{generate-id(.)}"/>
        <a href="#{generate-id(.)}" style="font-size: 1em;">
            <xsl:number level="any"/>
        </a>
        <xsl:text> </xsl:text>
    </xsl:template>
    
    <!--  Registerbegriffe markieren -->
    <xsl:template match="t:persName" mode="original">
       <a style="background-color: none">
    	<span class="person">
    	    <xsl:attribute name="title">
    	        <xsl:choose>
    	            <xsl:when test="child::t:reg">
    	                <xsl:value-of select="t:reg" />
    	            </xsl:when>
    	            <xsl:otherwise>
    	                <xsl:value-of select="@key" />
    	            </xsl:otherwise>
    	        </xsl:choose>
    	    </xsl:attribute>
    	    <xsl:attribute name="id">
    			<xsl:value-of select="@xml:id" />
    	    </xsl:attribute>
    	    <xsl:choose>
    	        <xsl:when test="child::t:orig">
    	            <xsl:value-of select="t:orig" />
    	        </xsl:when>
    	        <xsl:otherwise>
    	            <xsl:value-of select="." />
    	        </xsl:otherwise>
    	    </xsl:choose>
    		
    	</span>
    	</a>
        
    </xsl:template>
    
    <xsl:template match="t:name" mode="original">
    	<a style="background-color: none">
    	
	    	<span class="work">
	    	    <xsl:attribute name="title">
	    	        <xsl:choose>
	    	            <xsl:when test="child::t:reg">
	    	                <xsl:value-of select="t:reg" />
	    	            </xsl:when>
	    	            <xsl:otherwise>
	    	                <xsl:value-of select="@key" />
	    	            </xsl:otherwise>
	    	        </xsl:choose>
	    	    </xsl:attribute>
	    		<xsl:attribute name="id">
	    			<xsl:value-of select="@xml:id" />
	    		</xsl:attribute>
	    	    <xsl:choose>
	    	        <xsl:when test="child::t:orig">
	    	            <xsl:value-of select="t:orig" />
	    	        </xsl:when>
	    	        <xsl:otherwise>
	    	            <xsl:value-of select="." />
	    	        </xsl:otherwise>
	    	    </xsl:choose>
	    	</span>
	    </a>
    </xsl:template> 
    
    <xsl:template match="t:placeName" mode="original">
    		<a style="background-color: none">
    	
	    	<span class="place">
	    		<xsl:attribute name="title">
	    		    <xsl:choose>
	    		        <xsl:when test="child::t:reg">
	    		            <xsl:value-of select="t:reg" />
	    		        </xsl:when>
	    		        <xsl:otherwise>
	    		            <xsl:choose>
	    		                <xsl:when test="not(number(substring(@value, 1, 1)+1))">
	    		                    <xsl:value-of select="." />
	    		                </xsl:when>
	    		                <xsl:otherwise>
	    		                    <xsl:value-of select="@key" />
	    		                </xsl:otherwise>
	    		            </xsl:choose>
	    		        </xsl:otherwise>
	    		    </xsl:choose>
	    		</xsl:attribute>
	    		<xsl:attribute name="id">
	    			<xsl:value-of select="@xml:id" />
	    		</xsl:attribute>
	    	    <xsl:choose>
	    	        <xsl:when test="child::t:orig">
	    	            <xsl:value-of select="t:orig" />
	    	        </xsl:when>
	    	        <xsl:otherwise>
	    	            <xsl:value-of select="." />
	    	        </xsl:otherwise>
	    	    </xsl:choose>
	    	</span>
    	</a>
    </xsl:template>
    
    
       
    
    <xsl:template name="fn">
        <xsl:if test="//t:text[@ana='layout']//t:note/@n">
            <xsl:for-each select="//t:text[@ana='layout']//t:note">
                <p>
                    <xsl:if test="@n">
                        <span class="n-fn">
                            <a id="{generate-id(.)}"/>
                            <a href="#n{generate-id(.)}">
                                <xsl:value-of select="position()"/>
                            </a>
                        </span>
                        
                        <span class="content-fn">
                            <xsl:apply-templates mode="original"/>
                        </span>
                    </xsl:if>
                </p>
            </xsl:for-each>
        </xsl:if>
    </xsl:template>
    <!-- original end -->
    
    
    <!-- analysis start -->
    
    
    <xsl:template match="t:interpGrp">
        
        <xsl:if test="@type='Narrative_Darstellungsebenen'">
            <h6 style="font-size: 0.9em; color: #045277; margin-left: 1em; margin-top: 0; padding-top: 0.5em; font-family: arial, verdana, helvetica, sans-serif;"><i18n:text><xsl:value-of select="translate(@type, '_', ' ')" /></i18n:text></h6>
            <form id="selector1" action="" style="margin-left: 1em;">
                
                <xsl:call-template name="interpretationGroup" />
            </form>
        </xsl:if>
        <xsl:if test="@type='Narrative_Darstellungsformen'">
            <h6 style="font-size: 0.9em; color: #045277; margin-left: 1em; margin-top: 0; padding-top: 0.5em; font-family: arial, verdana, helvetica, sans-serif;"><i18n:text><xsl:value-of select="translate(@type, '_', ' ')" /></i18n:text></h6>
            <form id="selector2" action="" style="margin-left: 1em;">
                
                <xsl:call-template name="interpretationGroup" />
            </form>
        </xsl:if>
        
    </xsl:template>
    
    <xsl:template name="interpretationGroup">
        <xsl:for-each select="t:interp">
            <xsl:sort select="."/>
            <xsl:choose>
                
                <xsl:when test="@xml:id = 'E1' or @xml:id = 'E2'">
                    <input class="input" type="checkbox" checked="checked" disabled="disabled">
                        <xsl:text> </xsl:text>
                        <span style="font-size: 0.85em;">
                        	<xsl:attribute name="class">
                        		<xsl:if test="@xml:id='E1'">
                        			<xsl:text>E1</xsl:text>
                        		</xsl:if>
                        		<xsl:if test="@xml:id='E2'">
                        			<xsl:text>E2</xsl:text>
                        		</xsl:if>
                        	</xsl:attribute>
                            <i18n:text><xsl:value-of select="."/></i18n:text>
                        </span><br />
                    </input>
                </xsl:when>
                
                <xsl:when test="@xml:id = //t:seg/@type">
                    <input type="checkbox" name="show" class="checkable">
                        <xsl:attribute name="value">
                            <xsl:value-of select="@xml:id" />
                        </xsl:attribute>
                        <xsl:text> </xsl:text>
                        <xsl:call-template name="interpGrp" />
                    </input>
                </xsl:when>
                
                <xsl:otherwise>
                    <input type="checkbox" disabled="disabled"> 
                        <xsl:text> </xsl:text>
                        <span class="disabled">
                            <xsl:call-template name="interpGrp" />
                        </span>
                    </input>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:for-each>
    </xsl:template>
    
    <xsl:template name="interpGrp">
        <xsl:choose>
            <xsl:when test="@xml:id='AL'">
                <span  style="font-size: 0.85em;" class="AL"><i18n:text>allegory</i18n:text></span><br />
            </xsl:when>
            <xsl:when test="@xml:id='TR'">
                <span  style="font-size: 0.85em;" class="TR"><i18n:text>dream</i18n:text></span><br />
            </xsl:when>
            <xsl:when test="@xml:id='F'">
                <span  style="font-size: 0.85em;" class="F"><i18n:text>fable</i18n:text></span><br />
            </xsl:when>
            <xsl:when test="@xml:id='S'">
                <span  style="font-size: 0.85em;" class="S"><i18n:text>satire</i18n:text></span><br />
            </xsl:when>
            <xsl:when test="@xml:id='EX'">
                <span  style="font-size: 0.85em;" class="EX"><i18n:text>example</i18n:text></span><br />
            </xsl:when>
            <xsl:when test="@xml:id='UT'">
                <span style="font-size: 0.85em;" class="UT"><i18n:text>utopia</i18n:text></span><br />
            </xsl:when>
            <xsl:otherwise>
                <span style="font-size: 0.85em;">
                	<xsl:attribute name="class">
                		<xsl:value-of select="@xml:id" />
                	</xsl:attribute>
                	<i18n:text><xsl:value-of select="." /></i18n:text>
                </span><br />
            </xsl:otherwise>
        </xsl:choose>
        </xsl:template>
    
     <xsl:template match="t:text[@ana='framings']/t:body/t:div/t:ab">
        <xsl:apply-templates select="t:seg[@type='E1']" />
    </xsl:template>
    
    <xsl:template match="t:seg[@type='E1']">
        <div class="E1" title="Ebene 1">
            <h3 class="E1_head"><i18n:text>Ebene 1</i18n:text></h3>
            <div class="E1_content">
                <xsl:apply-templates  mode="analysis"/>
            </div>
        </div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='U1']" mode="analysis">
        <h1><xsl:apply-templates mode="analysis" /></h1>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='U2']" mode="analysis">
        <h2><xsl:apply-templates mode="analysis" /></h2>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='U3']" mode="analysis">
        <h3><xsl:apply-templates mode="analysis" /></h3>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='AU']" mode="analysis">
        <h2 class="AU"><xsl:apply-templates  mode="analysis"/></h2>
    </xsl:template>
    
    <!-- FIXME: wird das tatsächlich nicht gebraucht? 2 matcher auf MO -->
   <!-- <xsl:template match="t:seg[@type='MO']" mode="analysis">
        <h2 class="M"><xsl:apply-templates  mode="analysis"/></h2>
    </xsl:template>-->
    
    <xsl:template match="t:seg[@type='QU']" mode="analysis">
        <h2 class="QU"><xsl:apply-templates  mode="analysis"/></h2>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='UM']" mode="analysis">
        <h2 class="UM"><xsl:apply-templates mode="analysis" /></h2>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='DT']" mode="analysis">
        <h2 class="DT"><xsl:apply-templates mode="analysis" /></h2>
    </xsl:template>
    
    <xsl:template match="t:lb" mode="analysis">
        <br />
    </xsl:template>   
    
    <xsl:template match="text()" mode="analysis">
        <xsl:variable name="bindestrich">
            <xsl:value-of select="substring(., string-length(.),  1)"/>
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="$bindestrich='-'"><xsl:value-of select="substring(., 1, string-length(.) -1)"/></xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="."/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="t:note" mode="analysis">
        <span class="superscript">
            
            <a>
                <xsl:attribute name="id">
                    <xsl:text>n</xsl:text>
                    <xsl:value-of select="@n"/>
                </xsl:attribute>
            </a>
            <a>
                <xsl:attribute name="href">
                    <xsl:text>#</xsl:text>
                    <xsl:value-of select="@n"/>
                </xsl:attribute>
                <xsl:value-of select="@n"/>
            </a>  
            
        </span>
        
    </xsl:template>
    
    <xsl:template name="fn-a">        
        <xsl:if test="//t:text[@ana='layout']//t:note/@n">
            <xsl:for-each select="//t:text[@ana='layout']//t:note">
                <p>
                    <xsl:if test="@n">                        
                        <span class="n-fn">
                            
                            <a>
                                <xsl:attribute name="id">
                                    <xsl:value-of select="@n"/>
                                </xsl:attribute>
                            </a>
                            <a>
                                <xsl:attribute name="href">
                                    <xsl:text>#n</xsl:text>                                    
                                    <xsl:value-of select="@n"/>
                                </xsl:attribute>                              
                                <xsl:value-of select="@n"/>
                            </a>			
                            
                        </span>	
                        <span class="content-fn"><xsl:apply-templates  mode="analysis" /></span>                        
                    </xsl:if>
                </p>
            </xsl:for-each>            
        </xsl:if>     
        
    </xsl:template>
    
    
    
    
    
    <xsl:template match="t:seg[@type='E2']" mode="analysis">
        <div class="E2" title="Ebene 2">
            
            <h3 class="E2_head"><i18n:text>Ebene 2</i18n:text></h3>
            <div class="E2_content">
                <xsl:apply-templates mode="analysis"/>
            </div>
            
        </div>
        <!--<div class="clear"></div>-->
        
    </xsl:template>
    
    
    
    <xsl:template match="t:seg[@type='E3']" mode="analysis">
        <div class="E3" title="Ebene 3"><h3 class="E3_head"><i18n:text>Ebene 3</i18n:text></h3><div class="E3_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='E4']" mode="analysis">
        <div class="E4" title="Ebene 4"><h3 class="E4_head"><i18n:text>Ebene 4</i18n:text></h3><div class="E4_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='E5']" mode="analysis">
        <div class="E5" title="Ebene 5"><h3 class="E5_head"><i18n:text>Ebene 5</i18n:text></h3><div class="E5_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='E6']" mode="analysis">
        <div class="E6" title="Ebene 6"><h3 class="E6_head"><i18n:text>Ebene 6</i18n:text></h3><div class="E6_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    
    
    
    <xsl:template match="t:seg[@type='AE']" mode="analysis">
        <div class="AE" title="Allgemeine Erzählung"><h3 class="AE_head"><i18n:text>generalacc</i18n:text></h3><div class="AE_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='SP']" mode="analysis">
        <div class="SP" title="Selbstportrait"><h3 class="SP_head"><i18n:text>selfportrait</i18n:text></h3><div class="SP_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='FP']" mode="analysis">
        <div class="FP" title="Fremdportrait"><h3 class="FP_head"><i18n:text>hetportrait</i18n:text></h3><div class="FP_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='D']" mode="analysis">
        <div class="D" title="Dialog"><h3 class="D_head"><i18n:text>dialogue</i18n:text></h3><div class="D_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='AL']" mode="analysis">
        <div class="AL" title="Allegorie"><h3 class="AL_head"><i18n:text>allegory</i18n:text></h3><div class="AL_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='TR']" mode="analysis">
        <div class="TR" title="Traum"><h3 class="TR_head"><i18n:text>dream</i18n:text></h3><div class="TR_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='F']" mode="analysis">
        <div class="F" title="Fabel"><h3 class="F_head"><i18n:text>fable</i18n:text></h3><div class="F_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='S']" mode="analysis">
        <div class="S" title="Satire"><h3 class="S_head"><i18n:text>satire</i18n:text></h3><div class="S_content"><xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='EX']" mode="analysis">
        <div class="EX" title="Exemplum"><h3 class="EX_head"><i18n:text>example</i18n:text></h3><div class="EX_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='UT']" mode="analysis">
        <div class="UT" title="Utopie"><h3 class="UT_head"><i18n:text>utopia</i18n:text></h3><div class="UT_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='MT']" mode="analysis">
        <div class="MT" title="Metatextualität"><h3 class="MT_head"><i18n:text>metatextuality</i18n:text></h3><div class="MT_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='MO']" mode="analysis">
        <div class="ZM" title="Zitat/Motto"><h3 class="ZM_head"><i18n:text>citation</i18n:text></h3><div class="ZM_content">
            <xsl:apply-templates mode="analysis" /></div></div>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='ZM']" mode="analysis">
        <xsl:choose>
            <xsl:when test="not(parent::t:seg[@type='MO'])">
                <div class="ZM" title="Zitat/Motto"><h3 class="ZM_head"><i18n:text>citation</i18n:text></h3><div class="ZM_content">
                    <xsl:apply-templates mode="analysis" /></div></div>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates mode="analysis" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="t:seg[@type='LB']" mode="analysis">
        <div class="LB" title="Leserbrief"><h3 class="LB_head"><i18n:text>lettertoeditor</i18n:text></h3><div class="LB_content"><xsl:apply-templates  mode="analysis"/></div></div>
    </xsl:template>
    
    
    
    
    <!-- ++++++++++++++++++++  Bibliografie +++++++++++++++++++++++ -->
    <xsl:template match="bibtex:file" mode="bibliography">
        <h1 class="result"><i18n:text>Bibliographie</i18n:text></h1>    
         <xsl:choose>
            <xsl:when test="@type='prim'">
                <h2><i18n:text>Primärliteratur</i18n:text></h2>
                <xsl:apply-templates select="bibtex:entry" mode="prim">
                    <xsl:sort select=".//bibtex:title" order="ascending"/>
                </xsl:apply-templates>
            </xsl:when>
            
            <xsl:when test="@type='sek'">
                <h2><i18n:text>Sekundärliteratur</i18n:text></h2>
                <xsl:apply-templates select="bibtex:entry" mode="sek" />
            </xsl:when>
            </xsl:choose>
    </xsl:template>


    <!-- ++++++++++++++++ Monographien ++++++++++++++++++ -->

    <xsl:template match="bibtex:entry" mode="sek">

        <xsl:for-each select="bibtex:book">
           
            <xsl:if test="bibtex:author!=''">
                <p>
                    <xsl:call-template name="Autoren">
                        <xsl:with-param name="allAuthors" select="bibtex:author"/>
                    </xsl:call-template>
                    <xsl:text>: </xsl:text>
                    <em>
                        <xsl:call-template name="untertitel">
                            <xsl:with-param name="sotttitle" select="bibtex:title"/>
                        </xsl:call-template>
                    </em>
                    <xsl:text>. </xsl:text>
                    <xsl:value-of select="bibtex:address"/>
                    <xsl:text>: </xsl:text>
                    <xsl:value-of select="bibtex:publisher"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="bibtex:year"/>
                    <xsl:text>.</xsl:text>
                </p>
            </xsl:if>
        </xsl:for-each>

        <!-- +++++++++++++++++++++++++++  Sammelwerke ++++++++++++++++++++++++++  -->

        <xsl:for-each select="bibtex:sammelwerk">
            
            <xsl:if test="bibtex:editor!=''">
                <p>
                    <xsl:call-template name="Herausgeber">
                        <xsl:with-param name="alleditors" select="bibtex:editor"/>
                    </xsl:call-template>
                    <xsl:call-template name="edEds"/>
                    <xsl:text>: </xsl:text>
                    <em>
                        <xsl:call-template name="untertitel">
                            <xsl:with-param name="sotttitle" select="bibtex:title"/>
                        </xsl:call-template>
                    </em>
                    <xsl:text>. </xsl:text>
                    <xsl:value-of select="bibtex:address"/>
                    <xsl:text>: </xsl:text>
                    <xsl:value-of select="bibtex:publisher"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="bibtex:year"/>
                    <xsl:text>.</xsl:text>
                </p>
            </xsl:if>
        </xsl:for-each>


        <!-- ++++++++++++++++++++ Beiträge in Sammelwerken ++++++++++++++++++ -->



        <xsl:for-each select="bibtex:incollection">
           
            <xsl:if test="bibtex:author!=''">
                <p>
                    <xsl:value-of select="bibtex:author"/>
                    <xsl:text>: </xsl:text>
                    <q>
                        <xsl:call-template name="untertitel">
                            <xsl:with-param name="sotttitle" select="bibtex:title"/>
                        </xsl:call-template>
                    </q>
                    <xsl:text>. In: </xsl:text>
                    <xsl:call-template name="Herausgeber">
                        <xsl:with-param name="alleditors" select="bibtex:editor"/>
                    </xsl:call-template>
                    <xsl:call-template name="edEds"/>
                    <em>
                        <xsl:call-template name="replaceSS">
                            <xsl:with-param name="replace" select="bibtex:booktitle"/>
                        </xsl:call-template>
                    </em>
                    <xsl:text>. </xsl:text>
                    <xsl:apply-templates select="bibtex:volume"/>
                    <xsl:value-of select="bibtex:address"/>
                    <xsl:text>: </xsl:text>
                    <xsl:value-of select="bibtex:publisher"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="bibtex:year"/>
                    <xsl:text>, </xsl:text>
                    <xsl:value-of select="bibtex:pages"/>
                    <xsl:text>.</xsl:text>
                </p>
            </xsl:if>
        </xsl:for-each>

        <!-- ++++++++++++++++++++++ Zeitschriftenaufsätze +++++++++++++++ -->



        <xsl:for-each select="bibtex:article">
            

            <p>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="bibtex:author"/>
                </xsl:call-template>
                <xsl:text>: </xsl:text>
                <q>
                    <xsl:call-template name="untertitel">
                        <xsl:with-param name="sotttitle" select="bibtex:title"/>
                    </xsl:call-template>
                </q>
                <xsl:text>. In: </xsl:text>
                <em>
                    <xsl:value-of select="bibtex:journal"/>
                </em>
                <xsl:text> </xsl:text>
                <xsl:value-of select="bibtex:number"/>
                <xsl:text>, </xsl:text>
                <xsl:value-of select="bibtex:year"/>
                <xsl:text>, </xsl:text>
                <xsl:value-of select="bibtex:pages"/>
                <xsl:text>.</xsl:text>
            </p>
        </xsl:for-each>
    </xsl:template>
    
    
    
    <xsl:template match="bibtex:entry" mode="prim">
        <xsl:for-each select="bibtex:book">
            
            <xsl:if test="bibtex:author!=''">
                <p>
                    <em>
                        <xsl:call-template name="untertitel">
                            <xsl:with-param name="sotttitle" select="bibtex:title"/>
                        </xsl:call-template>
                    </em>
                    <xsl:text>, </xsl:text>
                    <xsl:call-template name="autoren">
                        <xsl:with-param name="authors" select="bibtex:author"/>
                    </xsl:call-template>
                    <xsl:text>, </xsl:text>
                    <xsl:value-of select="bibtex:address"/>
                    <xsl:text>, </xsl:text>
                    <xsl:value-of select="bibtex:publisher"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="bibtex:year"/>
                    <xsl:for-each select="bibtex:volume">
                        <xsl:text>, </xsl:text>
                        <xsl:value-of select="."/>
                        <xsl:text> vol</xsl:text>
                    </xsl:for-each>
                    <xsl:text>.</xsl:text>
                </p>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>



    <!--Templates und Funktionen-->

    <!-- Monographien **** Autoren, wenn mehrere Angaben-->

    <xsl:template name="zweiterautor">
        <xsl:param name="fnlnautor"/>
        <xsl:variable name="lastna" select="substring-before($fnlnautor, ',')"/>
        <xsl:variable name="firstna" select="substring-after($fnlnautor, ', ')"/>
        <xsl:choose>
            <xsl:when test="position() = 1">
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$lastna"/>
                </xsl:call-template>
                <xsl:text>, </xsl:text>
                <xsl:value-of select="$firstna"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$firstna"/>
                <xsl:text> </xsl:text>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$lastna"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="Autoren">
        <xsl:param name="allAuthors"/>
        <xsl:choose>
            <xsl:when test="count($allAuthors) &gt; 1">
                <xsl:for-each select="$allAuthors">
                    <xsl:call-template name="zweiterautor">
                        <xsl:with-param name="fnlnautor" select="."/>
                    </xsl:call-template>
                    <xsl:if test="position() != last()">
                        <xsl:text>/</xsl:text>
                    </xsl:if>
                </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="bibtex:author"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!-- wenn mehrere Herausgeber von Sammelwerken, dann Eds. -->
    <xsl:template name="edEds">
        <xsl:choose>
            <xsl:when test="count(bibtex:editor) &gt; 1">
                <xsl:text> (Eds.): </xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text> (Ed.): </xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--  **** Titel und Untertitel werden durch "." getrennt-->
    <xsl:template name="untertitel">
        <xsl:param name="sotttitle"/>
        <xsl:variable name="titel" select="substring-before ($sotttitle, ':')"/>
        <xsl:variable name="utitel" select="substring-after ($sotttitle, ':')"/>
        <xsl:choose>
            <xsl:when test="contains($sotttitle, ':')">
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$titel"/>
                </xsl:call-template>
                <xsl:text>. </xsl:text>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$utitel"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$sotttitle"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
   
    <!-- wenn Bände angegeben sind, sollen diese ausgegeben werden -->
    <xsl:template match="bibtex:volume">
        <xsl:text>Vol. </xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>. </xsl:text>
    </xsl:template>

    <!--Herausgeber von Sammelwerken: zuerst Vorname, dann Nachname-->
    <xsl:template name="editors">
        <xsl:param name="fnlneditors"/>
        <xsl:variable name="lastn" select="substring-before($fnlneditors, ',')"/>
        <xsl:variable name="firstn" select="substring-after($fnlneditors, ', ')"/>
        <xsl:call-template name="replaceSS">
            <xsl:with-param name="replace" select="$firstn"/>
        </xsl:call-template>
        <xsl:text> </xsl:text>
        <xsl:call-template name="replaceSS">
            <xsl:with-param name="replace" select="$lastn"/>
        </xsl:call-template>
    </xsl:template>

    <!--Herausgeber von Sammelwerken: wenn mehrere Herausgeber-->
    <xsl:template name="Herausgeber">
        <xsl:param name="alleditors"/>
        <xsl:choose>
            <xsl:when test="count($alleditors) &gt; 1">
                <xsl:for-each select="$alleditors">
                    <xsl:call-template name="editors">
                        <xsl:with-param name="fnlneditors" select="."/>
                    </xsl:call-template>
                    <xsl:if test="position() != last()">
                        <xsl:text>/</xsl:text>
                    </xsl:if>
                </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="editors">
                    <xsl:with-param name="fnlneditors" select="bibtex:editor"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <!--
        Die Funktion replaceSS ersetzt die Zeichenfolge {\ss} durch ein ß
    -->
    <xsl:template name="replaceSS">
        <xsl:param name="replace"/>
        <xsl:choose>
            <xsl:when test="contains($replace, '{ss}')">
                <xsl:value-of select="substring-before($replace, '{ss}')"/>
                <xsl:text>ß</xsl:text>
                <xsl:variable name="last" select="substring-after($replace, '{ss}')"/>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$last"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="contains($replace, '{\ss}')">
                <xsl:value-of select="substring-before($replace, '{\ss}')"/>
                <xsl:text>ß</xsl:text>
                <xsl:variable name="last" select="substring-after($replace, '{\ss}')"/>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$last"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$replace"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    
    <!-- Primärliteratur -->
    
    <!-- Autoren: zuerst Vorname, dann Nachname -->
    
    <xsl:template name="autozit">
        <xsl:param name="fnlnname"/>
        <xsl:variable name="firstna" select="substring-after($fnlnname, ', ')"/>
        <xsl:variable name="lastna" select="substring-before($fnlnname, ',')"/>
        <xsl:choose>
            <xsl:when test="contains($fnlnname, ',')">
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$firstna"/>
                </xsl:call-template>
                <xsl:text> </xsl:text>
                <xsl:call-template name="replaceSS">
                    <xsl:with-param name="replace" select="$lastna"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$fnlnname"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    
    <xsl:template name="autoren">
        <xsl:param name="authors"/>
        <xsl:choose>
            <xsl:when test="count($authors) &gt; 1">
                <xsl:for-each select="$authors">
                    <xsl:call-template name="autozit">
                        <xsl:with-param name="fnlnname" select="."/>
                    </xsl:call-template>
                    <xsl:if test="position() != last()">
                        <xsl:text>/</xsl:text>
                    </xsl:if>
                </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="autozit">
                    <xsl:with-param name="fnlnname" select="bibtex:author"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
</xsl:stylesheet>
