BetweenPageBreaks

From TEIWiki
Jump to navigation Jump to search

This stylesheet iteratively transforms the content between two page breaks in TEI to generate an HTML output that is put in a specific file (one output per page), with the purpose of creating a navigation allowing one to browse through pages.

The work has been done under my supervision by Solenne Coutagne, Master student at Ecole Naitonal des Chartes.

Laurent Romary

Input: a TEI document with all pages numbered (@n) and pointing to a scan (@facs).

Output: a series of HTML documents

Note: one of the outputs is a verbatim transform of the source, which is made by means of the xmlverbatimwrapper.xsl stylesheet, easy to find online.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp " ">]>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0"
    exclude-result-prefixes="tei">

    <!-- I import the xslt who is usefull for the XML-Datei -->
    <xsl:import href="xmlverbatimwrapper.xsl"/>

    <xsl:output indent="yes" method="html" encoding="UTF-8"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

    <!-- a template who creates the html structure of the menu -->
    <xsl:template name="menu">
        <!-- the header of the html page -->
        <div id="header">
            <!-- the first part of the header -->
            <div id="bandeau">
                <!-- link to the homepage on the picture "Nachwuchsgruppe Berliner Intellektuelle" -->
                <a href="../../accueil3.html">
                    <img id="image_bandeau" src="../../bandeau_petit.jpg" alt="bandeau"/>
                </a>
                <!-- choice between the languages -->
                <div id="links">
                    <a>Deutsch</a>
                    <a> English</a>
                    <!-- the pictures to the partnerships : emmy noerther, humboldt...-->
                    <a href="http://www.dfg.de/foerderung/faq/emmy_noether_faq/index.html">
                        <img src="../../emmy_noether.jpg" alt="Emmy Noether Program"/>
                    </a>
                    <a href="http://www.hu-berlin.de/">
                        <img src="../../humboldt.jpg" alt="Humboldt Universität zu Berlin"/>
                    </a>
                </div>
            </div>
            <!-- the second part : the menus -->
            <!-- menu for the different projects -->
            <div id="projekte">
                <ul class="menu">
                    <li>
                        <a class="unter_projekt"
                            href="../../franzosen_in_berlin/franzosen_in_berlin.html">FRANZOSEN IN
                            BERLIN</a>
                    </li>
                    <li>
                        <a class="unter_projekt"
                            href="../../wissenchaft_und_politik/wissenchaft_und_politik.html"
                            >WISSENCHAFT & POLITIK</a>
                    </li>
                    <li>
                        <a class="unter_projekt"
                            href="../../romantische_schluesseltexte/romantische_schluesseltexte.html"
                            >ROMANTISCHE SCHLÜSSELTEXTE</a>
                    </li>
                    <li>
                        <a class="unter_projekt"
                            href="../../freitag_gesellschaft/freitag_gesellschaft.html"
                            >FREITAG-GESELLSCHAFT</a>
                    </li>
                    <li>
                        <a class="unter_projekt" href="../../tieckiana/tieckiana.html">TIECKIANA</a>
                    </li>
                </ul>
            </div>
            <!-- the second menu -->
            <div id="menu">
                <ul class="menu">
                    <li>
                        <a class="item_menu" href="">Editorische Richtlinien</a>
                    </li>
                    <li>
                        <a class="item_menu" href="">Briefe</a>
                        <ul>
                            <li>
                                <a class="item_menu">nach Jahr</a>
                            </li>
                            <li>
                                <a class="item_menu">nach Ort</a>
                            </li>
                            <li>
                                <a class="item_menu">nach Besitzer</a>
                            </li>
                            <li>
                                <a class="item_menu">nach Absender</a>
                            </li>
                            <li>
                                <a class="item_menu">nach Adressat</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a class="item_menu" href="">Suche</a>
                        <ul>
                            <li>
                                <a href="" class="item_menu">Einfache Suche</a>
                            </li>
                            <li>
                                <a href="" class="item_menu">Erweiterte Suche</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a class="item_menu" href="">Kontakt</a>
                    </li>
                    <li>
                        <a class="item_menu" href="">Aktuell</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- the titel of the letter -->
        <div id="titel">
            <a href="javascript:DivStatus( 'mondiv', '1' )">
                <xsl:value-of select="normalize-space(//tei:titleStmt/tei:title)"/>
            </a>
        </div>
        <!-- when we click on the titel, a hidden div appears with some metadata (all the respStmt and the msIdentifier from the institution to the idno). -->
        <div name="mondiv1" id="mondiv1" class="cachediv">
            <div id="divcache">
                <xsl:for-each select="//tei:respStmt">
                    <xsl:value-of select="concat(tei:resp, ': ', tei:persName | tei:orgName)"/>
                    <br/>
                </xsl:for-each>
                <!-- when one of these elements has an other element after, we scribe a comma. when there isn't any brother element : a point. -->
                <xsl:if test="//tei:msIdentifier/tei:institution">
                    <xsl:choose>
                        <xsl:when test="//tei:institution/following-sibling::node()">
                            <xsl:value-of select="concat(//tei:msIdentifier/tei:institution, ',')"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="concat(//tei:msIdentifier/tei:institution, '.')"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:if>
                <xsl:if test="//tei:msIdentifier/tei:repository">
                    <xsl:choose>
                        <xsl:when test="//tei:repository/following-sibling::node()">
                            <xsl:value-of select="concat(//tei:msIdentifier/tei:repository, ',')"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="concat(//tei:msIdentifier/tei:repository, '.')"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:if>
                <xsl:if test="//tei:msIdentifier/tei:collection">
                    <xsl:choose>
                        <xsl:when test="//tei:collection/following-sibling::node()">
                            <xsl:value-of select="concat(//tei:msIdentifier/tei:collection, ',')"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="concat(//tei:msIdentifier/tei:collection, '.')"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:if>
                <xsl:if test="//tei:msIdentifier/tei:idno">
                    <xsl:value-of select="concat(//tei:msIdentifier/tei:idno, '.')"/>
                </xsl:if>
            </div>
        </div>
    </xsl:template>

    <!-- I continue with a template with a @name in order to avoid the duplication caused by the using of <xsl:result-document> (XSLT 2.0). I repeated twice the same structure of the document html while it was almost the same. the only difference was the links. I have so a template with @name=structure (for structure of the html document).-->
    <xsl:template name="structure">
        <!-- I create a parameter in order to differenciate the two output of the transcription : the first one true to the original, the second one more readable. the third one is the source code of the tei document.-->
        <xsl:param name="output"/>
        <!-- structure of the html document. In the <head>, all the links for css/javascript documents-->
        <html>
            <head>
                <title>
                    <xsl:value-of select="normalize-space(//tei:titleStmt/tei:title)"/>
                </title>
                <link rel="stylesheet" type="text/css" href="../../test.css"/>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
                <script type="text/javascript" src="../../mojozoom.js"/>
                <script src="FancyZoom 1.1/js-global/FancyZoom.js" type="text/javascript"/>
                <script src="FancyZoom 1.1/js-global/FancyZoomHTML.js" type="text/javascript"/>
                <script src="../../cachediv.js" type="text/javascript"/>
            </head>
            <body onload="initialize()">
                <!-- I call the template @name=menu-->
                <xsl:call-template name="menu"/>
                <!-- the place of the digitalised picture in a div @id="facs"-->
                <div id="facs">
                    <xsl:element name="a">
                        <xsl:attribute name="href">
                            <xsl:value-of select="@facs"/>
                        </xsl:attribute>
                        <xsl:element name="img">
                            <xsl:attribute name="src">
                                <!-- the picture on the website is more little that the real digitalised picture. I call the little picture : the name of the big picture with a "k" at the end ("k" for "klein"). for example : 00000855k.jpg. -->
                                <xsl:value-of
                                    select="concat(substring-before(@facs, '.jpg'), 'k', '.jpg')"/>
                            </xsl:attribute>
                            <!-- this attribute is defined by the mojozoom.js (a javascript file) for the zoom and put a link to the big picture.-->
                            <xsl:attribute name="data-zoomsrc">
                                <xsl:value-of select="@facs"/>
                            </xsl:attribute>
                            <xsl:attribute name="alt">
                                <xsl:value-of select="bild"/>
                            </xsl:attribute>
                        </xsl:element>
                    </xsl:element>
                </div>
                <div id="transkription">
                    <!-- menu for the choice between the three versions of the transcription. -->
                    <div id="inhaltsverzeichnis">
                        <p class="type_transcription">
                            <!-- I define an url for the three versions.-->
                            <a href="xml.html" class="item_menu">XML-Datei </a>
                        </p>
                        <p class="type_transcription">
                            <a href="page_{@n}_korrigiert.html" class="item_menu"> Kritisch</a>
                        </p>
                        <p class="type_transcription">
                            <a href="page_{@n}_urtext.html" class="item_menu">Diplomatisch</a>
                        </p>
                    </div>
                    <br/>
                    <br/>
                    <div id="text">
                        <!-- when there is a pagebreak before the place where we are -->
                        <!-- a variable in order to be a little more concise -->
                            <xsl:variable name="letzte_seite" select="preceding::tei:pb[1]"/>
                                <xsl:if test="$letzte_seite">
                            <!-- a choice : if the parameter is 'urtext' so I do this link to the version true to the original -->
                            <xsl:choose>
                                <xsl:when test="$output='urtext'">
                                    <a href="page_{$letzte_seite/@n}_urtext.html">[Seite
                                            <xsl:value-of select="$letzte_seite/@n"/>] </a>
                                    <br/>
                                </xsl:when>
                                <!-- if it's 'korrigiert', I do an other link (to the previous page of the readable version).  -->
                                <xsl:when test="$output='korrigiert'">
                                    <a href="page_{$letzte_seite/@n}_korrigiert.html">[Seite
                                            <xsl:value-of select="$letzte_seite/@n"/>] </a>
                                    <br/>
                                </xsl:when>
                            </xsl:choose>
                        </xsl:if>
                        <!-- apply-templates on the body. We can see in this apply-templates, three mentions of parameters. We know already what is output. anfang and ende : i use those parameters in order to have one html document for one page of letter. 
                        anfang : where we are
                        ende : the next pagebreak-->
                        <xsl:apply-templates select="//tei:body">
                            <xsl:with-param name="anfang" select="."/>
                            <xsl:with-param name="ende" select="following::tei:pb[1]"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>
                        <br/><br/><br/><br/><br/>
                        <!-- the same thing for the next page that for the previous page. cf supra.-->
                        <xsl:variable name="naechste_seite" select="following::tei:pb[1]"/>
                        <xsl:if test="$naechste_seite">
                            <xsl:choose>
                                <xsl:when test="$output='urtext'">
                                    <a href="page_{$naechste_seite/@n}_urtext.html">[Seite
                                            <xsl:value-of select="$naechste_seite/@n"/>] </a>
                                    <br/>
                                    <br/>
                                </xsl:when>
                                <xsl:when test="$output='korrigiert'">
                                    <a href="page_{$naechste_seite/@n}_korrigiert.html">[Seite
                                            <xsl:value-of select="$naechste_seite/@n"/>] </a>
                                    <br/>
                                    <br/>
                                </xsl:when>
                            </xsl:choose>
                        </xsl:if>
                    </div>
                </div>
            </body>
        </html>
    </xsl:template>

    <!-- and now, the result-document. Each time I meet an element <pb>, XSLT create a document HTML with a different parameter called "output". -->
    <xsl:template match="/">
        <xsl:for-each select="//tei:pb">
            <xsl:result-document method="html" href="page_{@n}_urtext.html">
                <xsl:call-template name="structure">
                    <xsl:with-param name="output" select="'urtext'"/>
                </xsl:call-template>
            </xsl:result-document>
        </xsl:for-each>
        <xsl:for-each select="//tei:pb">
            <xsl:result-document method="html" href="page_{@n}_korrigiert.html">
                <xsl:call-template name="structure">
                    <xsl:with-param name="output" select="'korrigiert'"/>
                </xsl:call-template>
            </xsl:result-document>
        </xsl:for-each>
        <xsl:result-document method="html" href="xml.html">
            <html>
                <head>
                    <title>
                        <xsl:value-of select="normalize-space(//tei:titleStmt/tei:title)"/>
                    </title>
                    <link rel="stylesheet" type="text/css" href="../../test.css"/>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
                </head>
                <body>
                    <xsl:call-template name="menu"/>
                    <div id="facs">
                        <xsl:for-each select="//tei:pb">
                            <img>
                                <xsl:attribute name="src">
                                    <xsl:value-of
                                        select="concat(substring-before(@facs, '.jpg'), 'k', '.jpg')"
                                    />
                                </xsl:attribute>
                            </img>
                        </xsl:for-each>
                    </div>
                    <div id="transkription">
                        <!-- menu for the choice between the three versions of the trancription. -->
                        <div id="inhaltsverzeichnis">
                            <p class="type_transcription">
                                <a href="xml.html">XML-Datei</a>
                            </p>
                            <p class="type_transcription">
                                <xsl:element name="a">
                                    <xsl:attribute name="href">
                                        <xsl:value-of
                                            select="concat('page_', //tei:div[@type='transkription']/*[1]/@n, '_korrigiert.html')"
                                        />
                                    </xsl:attribute>
                                    <xsl:text>Kritisch</xsl:text>
                                </xsl:element>
                            </p>
                            <p class="type_transcription">
                                <xsl:element name="a">
                                    <xsl:attribute name="href">
                                        <xsl:value-of
                                            select="concat('page_', //tei:div[@type='transkription']/*[1]/@n, '_urtext.html')"
                                        />
                                    </xsl:attribute>
                                    <xsl:text>Diplomatisch</xsl:text>
                                </xsl:element>
                            </p>
                        </div>
                        <div id="text">
                            <xsl:apply-templates select="." mode="xmlverb"/>
                        </div>
                    </div>
                </body>
            </html>
        </xsl:result-document>
    </xsl:template>

    <!-- A template for the node text. And for all the templates below, this is the same scheme. We declare the three parameters : anfang, ende and output. And then : <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])"> -> when we are before the pagebreak where we are (not(following::tei:pb[@n=$anfang/@n])) : no treatment. When we are after the next pagebreak on which we are (not(preceding::tei:pb[@n=$ende/@n])) : no treatment. In other words, when we are not before the pb or after the next pagebreak, we apply a treatment. In this case, value-of on all the text -->

    <xsl:template match="text()">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:value-of select="."/>
        </xsl:if>
    </xsl:template>

    <!-- I take care now of the layout elements. -->
    <!-- paragraphs...-->
    <xsl:template match="tei:p">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <p>
                <xsl:apply-templates>
                    <xsl:with-param name="anfang" select="$anfang"/>
                    <xsl:with-param name="ende" select="$ende"/>
                    <xsl:with-param name="output" select="$output"/>
                </xsl:apply-templates>
            </p>
        </xsl:if>
    </xsl:template>

    <!-- les linebreaks...-->
    <xsl:template match="tei:lb">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <br/>
        </xsl:if>
    </xsl:template>

    <!-- a template "rendition" that I will call for all the element who can have a @rendition attribute -->
    <xsl:template name="rendition">
        <xsl:param name="rend"/>
        <xsl:if test="$rend != ''">
            <xsl:attribute name="class">
                <xsl:for-each select="tokenize($rend, '\s')">
                    <!-- pour chacun des mots obtenus, on sort la partie qui suit le caractère #-->
                    <xsl:value-of select="concat(substring-after(., '#'), ' ')"/>
                    <xsl:if test="position() != last()"/>
                </xsl:for-each>
            </xsl:attribute>
        </xsl:if>
    </xsl:template>

    <!-- additions -->
    <xsl:template  match="//tei:add[not(ancestor::tei:subst)]">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:choose><xsl:when test="$output='urtext'">
                <p>
                <xsl:call-template name="rendition">
                    <xsl:with-param name="rend" select="@rendition"/>
                </xsl:call-template>
                <xsl:apply-templates>
                    <xsl:with-param name="anfang" select="$anfang"/>
                    <xsl:with-param name="ende" select="$ende"/>
                    <xsl:with-param name="output" select="$output"/>
                </xsl:apply-templates>
                </p></xsl:when>
            <xsl:otherwise>
                <p>
                    <xsl:apply-templates>
                        <xsl:with-param name="anfang" select="$anfang"/>
                        <xsl:with-param name="ende" select="$ende"/>
                        <xsl:with-param name="output" select="$output"/>
                    </xsl:apply-templates>
                </p>
            </xsl:otherwise>
            </xsl:choose>
            </xsl:if>
    </xsl:template>
    
    <xsl:template match="tei:subst/tei:add">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
        <xsl:if test="$output='urtext'">
            <xsl:choose>
                <xsl:when test="@place='above'">
                    <sup>
                        <xsl:apply-templates>
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                        </xsl:apply-templates>
                    </sup>
                </xsl:when>
                <xsl:when test="@place='below'">
                    <sub>
                        <xsl:apply-templates>
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                        </xsl:apply-templates>
                    </sub>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:apply-templates>
                        <xsl:with-param name="anfang" select="$anfang"/>
                        <xsl:with-param name="ende" select="$ende"/>
                    </xsl:apply-templates>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:if>
        <xsl:if test="$output='korrigiert'">
            <xsl:apply-templates>
                <xsl:with-param name="anfang" select="$anfang"/>
                <xsl:with-param name="ende" select="$ende"/>
            </xsl:apply-templates>
        </xsl:if>
            </xsl:if>
    </xsl:template>
    
    <!-- the deletions : presents only in the true to original version. In other case, they don't appears.-->
    <xsl:template match="tei:del">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:if test="$output='urtext'">
                <del>
                    <xsl:apply-templates>
                        <xsl:with-param name="anfang" select="$anfang"/>
                        <xsl:with-param name="ende" select="$ende"/>
                    </xsl:apply-templates>
                </del>
            </xsl:if>
        </xsl:if>
    </xsl:template>

    <!-- les underlinings : underlining only in true to original version. In the other case, we treat the element but only in order to the words appears, not the underlining. -->
    <xsl:template match="//tei:hi[@rend='underline']">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:choose>
                <xsl:when test="$output='urtext'">
                    <u>
                        <xsl:apply-templates>
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>
                    </u>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:apply-templates>
                        <xsl:with-param name="anfang" select="$anfang"/>
                        <xsl:with-param name="ende" select="$ende"/>
                        <xsl:with-param name="output" select="korrigiert"/>
                    </xsl:apply-templates>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:if>
    </xsl:template>
    <xsl:template match="tei:hi[@rend='italic']">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
                    <i>
                        <xsl:apply-templates>
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>
                    </i>
        </xsl:if>
    </xsl:template>

    <!--opener.  -->
    <xsl:template match="tei:dateline">
        <xsl:param name="output"/>
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:choose>
                <xsl:when test="//tei:dateline[@rendition] and $output='urtext'">
                    <p>
                        <xsl:call-template name="rendition">
                            <xsl:with-param name="rend" select="@rendition"/>
                        </xsl:call-template>
                        <xsl:apply-templates select="tei:settlement">
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>   <xsl:apply-templates select="tei:date">
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates></p>
                </xsl:when>
                <!-- otherwise, we use only a p element -->
                <xsl:otherwise>
                    <p>
                        <xsl:apply-templates select="tei:settlement">
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>   <xsl:apply-templates select="tei:date">
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates></p>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:if>
    </xsl:template>

    <!--  salute and signed -->
    <xsl:template match="tei:salute | tei:signed">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:choose>
                <xsl:when test="//tei:dateline[@rendition] and $output='urtext'">
                    <p>
                        <xsl:call-template name="rendition">
                            <xsl:with-param name="rend" select="@rendition"/>
                        </xsl:call-template>
                        <xsl:apply-templates>
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>
                    </p>
                </xsl:when>
                <xsl:otherwise>
                    <p>
                        <xsl:apply-templates>
                            <xsl:with-param name="anfang" select="$anfang"/>
                            <xsl:with-param name="ende" select="$ende"/>
                            <xsl:with-param name="output" select="$output"/>
                        </xsl:apply-templates>
                    </p>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:if>
    </xsl:template>

    <!--gap und unclear-->
    <xsl:template match="tei:gap">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:text>[...]</xsl:text>
        </xsl:if>
    </xsl:template>
    <xsl:template match="tei:unclear">
        <xsl:param name="output"/>
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:value-of select="concat('[', normalize-space(.), ']')"/>
        </xsl:if>
    </xsl:template>

    <!-- abbreviations, regularisations, corrections : all the elements in TEI using <choice>.-->
    <xsl:template match="//tei:expan | //tei:reg | //tei:corr">
        <xsl:param name="output"/>
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:if test="$output='korrigiert'">
                <xsl:apply-templates>
                    <xsl:with-param name="anfang" select="$anfang"/>
                    <xsl:with-param name="ende" select="$ende"/>
                </xsl:apply-templates>
            </xsl:if>
        </xsl:if>
    </xsl:template>

    <xsl:template match="//tei:abbr | //tei:orig | //tei:sic">
        <xsl:param name="output"/>
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <xsl:if test="$output='urtext'">
                <xsl:apply-templates>
                    <xsl:with-param name="anfang" select="$anfang"/>
                    <xsl:with-param name="ende" select="$ende"/>
                </xsl:apply-templates>
            </xsl:if>
        </xsl:if>
    </xsl:template>

    <!-- Notes of the document, for the moment, only a <p>. -->
    <xsl:template match="tei:note[not(@resp)]">
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:param name="output"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <p>
                <xsl:apply-templates>
                    <xsl:with-param name="anfang" select="$anfang"/>
                    <xsl:with-param name="ende" select="$ende"/>
                    <xsl:with-param name="output" select="$output"/>
                </xsl:apply-templates>
            </p>
        </xsl:if>
    </xsl:template>

    <!--Notes of the researchers. -->
    <!--I put an anchor a number and an "info-bulle"-->
    <xsl:template match="tei:note[@resp]">
        <xsl:param name="output"/>
        <xsl:param name="anfang"/>
        <xsl:param name="ende"/>
        <xsl:if test="not(following::tei:pb[@n=$anfang/@n]) and not(preceding::tei:pb[@n=$ende/@n])">
            <a class="info_anmerkung" href="#">
                <sup>
                    <xsl:value-of select="count(preceding::tei:note) + 1"/>
                </sup>
                <span>
                    <xsl:value-of select=".[@xml:id]"/>
                </span>
            </a>


        </xsl:if>
    </xsl:template>

</xsl:stylesheet>