<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   
    
    
    <xsl:template match="TEI.2">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master
            master-name="normale"
            page-width="210mm"
            page-height="297mm"
            margin-top="2cm"
            margin-bottom="2cm"
            margin-left="2cm"
            margin-right="2cm">
            <fo:region-body   margin-top="1cm" margin-bottom="1cm"/>
            <fo:region-before extent="1cm" />
            <fo:region-after  extent="1cm" />
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence
        master-reference="normale"
        initial-page-number="1"
        language="it"
        country="it">
        
       
        <fo:static-content flow-name="xsl-region-before" font-family="serif">
            <fo:block text-align="center" font-size="8pt">Centro Studi GIACOMO PUCCINI - Lettera Epistolario</fo:block>
        </fo:static-content>
        
        <!-- Visualization of the last date of change and the declaration of copyright -->
        <fo:static-content flow-name="xsl-region-after" font-family="serif">
            <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"></fo:block>
            <fo:block text-align="right" font-style="italic">
               Data: 
                    <xsl:apply-templates select="//revisionDesc/descendant::date[last()]"/>	
                    <xsl:text> </xsl:text> &#169; 
                    <xsl:apply-templates select="//fileDesc/publicationStmt/publisher"/>
           </fo:block>
        </fo:static-content>
        
        <fo:flow flow-name="xsl-region-body" font-family="serif" line-height="130%">
            <fo:block font-weight="bold"  font-family="serif">
                <xsl:apply-templates select="teiHeader/fileDesc/titleStmt/title"/>
            </fo:block>
            
            
            
            <!-- In according to the publishing criteria, the information that aren't expressed inside of the letter must be contained between square parentheses [].  In the section ' letHeading' that happens estimating the value of the attribute attested of every element-->
            
            
            <fo:block text-align="left">
                <xsl:choose>
                    
                    
                <xsl:when test="//letHeading/addressee[@attested='yes']">
                    <fo:block font-weight="bold">Destinatario: <xsl:apply-templates select="//letHeading/addressee/persName"/>
                        <xsl:if test="//letHeading/addressee/supplied">, <xsl:apply-templates select="//letHeading/addressee/supplied"/> </xsl:if>
                        <xsl:if test="//letHeading/addressee/placeName">
                        <fo:inline font-weight="bold">, <xsl:apply-templates select="//letHeading/addressee/placeName"/></fo:inline>
                        </xsl:if>
                        <xsl:call-template name="datazione"/> 
                    </fo:block> 
                   
                    <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"></fo:block>
                </xsl:when>
                
                 <xsl:when test="//letHeading/addressee[@attested='added']">
                     <fo:block font-weight="bold">Destinatario: [<xsl:apply-templates select="//letHeading/addressee/persName"/>]
                           <xsl:if test="//letHeading/addressee/supplied"> <xsl:apply-templates select="//letHeading/addressee/supplied"/> </xsl:if>
                           <xsl:if test="//letHeading/addressee/placeName">
                               <fo:inline font-weight="bold">, <xsl:apply-templates select="//letHeading/addressee/placeName"/></fo:inline>
                           </xsl:if>
                         <xsl:call-template name="datazione"/>
                     </fo:block>
                     <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"></fo:block>
                 </xsl:when>   
                    
                 <xsl:when test="//letHeading/addressee[@attested='no']">
                     <fo:block font-weight="bold">Destinatario: [<xsl:apply-templates select="//letHeading/addressee/persName"/>]
                           <xsl:if test="//letHeading/addressee/supplied">, <xsl:apply-templates select="//letHeading/addressee/supplied"/> </xsl:if>
                           <xsl:if test="//letHeading/addressee/placeName">
                               <fo:inline font-weight="bold">, <xsl:apply-templates select="//letHeading/addressee/placeName"/> </fo:inline>
                           </xsl:if>
                         <xsl:call-template name="datazione"/>
                     </fo:block> 
                     <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"></fo:block>
                  </xsl:when>
                 
                </xsl:choose>
            </fo:block>
            
            <!-- Visualization of the physical description of the document -->
            <fo:block>
            <fo:inline font-variant="small-caps"><xsl:apply-templates select="//letDesc/physDesc/type"/>
                <xsl:text> </xsl:text>
                <xsl:apply-templates select="//letDesc/physDesc/support/p"/>
                <xsl:apply-templates select="//letDesc/physDesc/layout/p"/></fo:inline>
            </fo:block>
            
            <!-- Callback of the informations contained in the section envelope that are managed in the next template called 'busta'-->
            <xsl:call-template name="busta"/>
            
            <fo:block line-height="130%">
                <xsl:apply-templates select="text"/>
            </fo:block>
            </fo:flow>
            
    </fo:page-sequence>
    </fo:root>
    </xsl:template>
    
    <!-- Visualization of the text of notes at the bottom of the page  --> 
    <xsl:template match="//note[@place='foot']"> 
        <fo:footnote>
            <fo:inline vertical-align="super" font-size="8pt"><xsl:number count="note" from="teiHeader" format="1" /></fo:inline>
            
            <fo:footnote-body>
                <fo:list-block>
                    <fo:list-item>
                        <fo:list-item-label end-indent="label-end()">
                            <fo:block font-size="8pt"><xsl:number count="note" from="teiHeader" format="1"/></fo:block>
                        </fo:list-item-label>
                        <fo:list-item-body start-indent="body-start()">
                            <fo:block color="black"><xsl:apply-templates/></fo:block>
                        </fo:list-item-body>
                    </fo:list-item>
                </fo:list-block>
               
            </fo:footnote-body>
            
        </fo:footnote>
    </xsl:template>
    
    <xsl:template name="intestazione2">
        <!--Visualization of the place where the original document is stored-->
        <fo:block> <fo:inline font-variant="small-caps">collocazione:</fo:inline>
            <xsl:text> </xsl:text>
            <xsl:apply-templates select="//letIdentifier/repository/@key"/> 
        </fo:block>
        
        <!--Visualization of the information about an eventual previous publisher of the document. If the document is unpublished will be print the wording "Not published"--> 
        <fo:block>
            <xsl:choose>
                <xsl:when test="//additional/listBibl/bibl">
                    <fo:block><fo:inline font-variant="small-caps">pubblicazione:</fo:inline>
                        <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//additional/listBibl/bibl" /></fo:block>
                </xsl:when>
              
                <xsl:otherwise> 
                    <xsl:choose>
                        <xsl:when test="//envelope[@type='telegram'] | //envelope[@type='biglietto']" ><fo:block font-variant="small-caps">inedito</fo:block></xsl:when>
                        <xsl:otherwise><fo:block font-variant="small-caps">inedita</fo:block></xsl:otherwise>
                    </xsl:choose>
                </xsl:otherwise>
            </xsl:choose>
        </fo:block>
        
        <!--Visualization of the information about typology of sources of the document-->
        <fo:block>
            <xsl:choose>
                <xsl:when test="//letIdentifier/note">
                    <fo:block><fo:inline font-variant="small-caps">trascrizione:</fo:inline>
                        <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//letIdentifier/note"/></fo:block>
                </xsl:when>
                <xsl:otherwise>
                </xsl:otherwise>
            </xsl:choose>
        </fo:block>
        
        <!--Visualization of explicatory notes in case a date is added by the editor--> 
        <fo:block>
        <xsl:choose>
            <xsl:when test="//letDesc/letHeading/note">
                <fo:block><fo:inline font-variant="small-caps">datazione:</fo:inline>
                    <xsl:text> </xsl:text> 
                    <xsl:apply-templates select="//letDesc/letHeading/note"/></fo:block> 
                <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"></fo:block> 
            </xsl:when>
            
            <xsl:otherwise>
                <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"></fo:block>
            </xsl:otherwise>
        </xsl:choose>
        </fo:block>
    </xsl:template>
    
    <xsl:template name="busta">
        
        <!--Visualization of the postal information concerning a specific document: the telegram -->	
        <fo:block>
        <xsl:choose>
            <xsl:when test="//envelope[@type='telegram']/envPart"><fo:block ><fo:inline font-style="italic">Ricevuto il </fo:inline>
                <xsl:apply-templates select="//envelope[@type='telegram']/envPart/postmark[@n='a']//date" /> /
                <fo:inline font-style="italic">Destinazione </fo:inline>  <xsl:apply-templates select="//envelope[@type='telegram']/envPart/postmark[@n='a']//placeName"/> / 
                <fo:inline font-style="italic">Provenienza </fo:inline>   <xsl:apply-templates select="//envelope[@type='telegram']/envPart/postmark[@n='d']//placeName"/> / 
                <fo:inline font-style="italic">Data della presentazione Giorno e mese </fo:inline> <xsl:apply-templates select="//envelope[@type='telegram']/envPart/postmark[@n='d']//date/text()"/>
                <fo:inline font-style="italic">Ore e minuti </fo:inline><xsl:apply-templates select="//envelope[@type='telegram']/envPart/postmark[@n='d']//time"/>
                <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"/>
                </fo:block>
            </xsl:when>
        </xsl:choose>
        </fo:block>
            
            <!--Visualization of the addressee's address-->	
            <fo:blook>
                <xsl:choose>
                    <xsl:when test="//envelope/envPart//address[@type='sender']">
                        <fo:inline  font-variant="small-caps">indirizzo del destinatario:<xsl:apply-templates select="//envelope/envPart/div/p"/>
                        <xsl:apply-templates select="//envelope/envPart//address[@type='sender']"/></fo:inline>
                    </xsl:when>
                </xsl:choose>
            </fo:blook>
        
        <fo:block>
        <xsl:choose>
            <xsl:when test="//envelope/envPart//address[@type='receiver']">
                <fo:inline  font-variant="small-caps">indirizzo:</fo:inline> <xsl:apply-templates select="//envelope/envPart/div/p"/> 
                    <xsl:apply-templates select="//envelope/envPart//address[@type='receiver']"/>
            </xsl:when>
        </xsl:choose>
        </fo:block>
            
            <!--Visualization of the postmark and assignation of the relative labels. The different labels are applied according to the value of the attribute n-->	
            <fo:block>
                <xsl:if test="//envelope[not(@type)]/envPart/postmark[@n='d']">
                    <fo:inline font-variant="small-caps">timbro postale di partenza:</fo:inline>
                    <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[@n='d']/placeName"/>   <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[@n='d']/date"/>
                </xsl:if>
            </fo:block>
                
                <fo:block>
                    <xsl:if test="//envelope[not(@type)]/envPart/postmark[@n='a']">
                        <fo:inline font-variant="small-caps">timbro postale di arrivo:</fo:inline>
                        <xsl:text> </xsl:text>
                            <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[@n='a']/placeName"/>   <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[@n='a']/date"/>
                    </xsl:if>
                </fo:block>
                
                <fo:block>
                    <xsl:if test="//envelope[not(@type)]/envPart/postmark[@n='t']">
                        <fo:inline font-variant="small-caps">timbro postale di transito:</fo:inline>
                        <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[@n='t']/placeName"/>   <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[@n='t']/date"/>
                    </xsl:if>
                </fo:block>
        
                <fo:block>
                    <xsl:if test="//envelope[not(@type)]/envPart/postmark[not(@n)]">
                        <fo:inline font-variant="small-caps">altro timbro postale:</fo:inline>
                        <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[not (@n)]/placeName"/>   <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//envelope[not(@type)]/envPart/postmark[not(@n)]/date"/>
                    </xsl:if>	
                </fo:block>
                
                <fo:block>
                    <xsl:if test="//envelope[not(@type)]/envPart/postmark[@n='p']">
                        <fo:inline font-variant="small-caps">timbro postale di protocollo:</fo:inline>
                        <xsl:text> </xsl:text>
                        <xsl:apply-templates select="//history/provenance"/>
                    </xsl:if>
                </fo:block>
                
        <fo:block>
        <xsl:choose>
            <xsl:when test="//envelope/envPart/postmark/note">
                <fo:block><xsl:apply-templates select="//envelope/envPart/postmark/note"/></fo:block>
            </xsl:when>
        </xsl:choose>
        </fo:block>
        
        <fo:block>
        <xsl:choose>
            <xsl:when test="//envPart[side='back']/div">
                <fo:block> <xsl:apply-templates select="//envelope[not(@type)]/envPart[side='back']/div/p"/></fo:block>
            </xsl:when>
        </xsl:choose>
        </fo:block>
        
        <fo:block>
        <xsl:choose>
            <xsl:when test="//envelope/envPart//note">
                <fo:block><xsl:apply-templates select="//envelope/envPart//note"/></fo:block>
                <fo:block space-before.minimum="3pt" space-before.maximun="24pt" space-before.optimum="12pt"/>
            </xsl:when>
        </xsl:choose>
            </fo:block>
        
        <xsl:call-template name="intestazione2"/>
    
    </xsl:template>
    
    <xsl:template match="revisionDesc" />
    <xsl:template match="profileDesc" />
    <xsl:template match="envelope" />
        
    <xsl:template match="address">
       
        <fo:inline>
        <xsl:apply-templates select="addrLine[position()=1]"/>
        </fo:inline>        
                 <fo:block text-indent="19mm">
                    <xsl:apply-templates select="addrLine[position()=2]"/>
                         </fo:block>
               <fo:block text-indent="19mm">
                    <xsl:apply-templates select="addrLine[position()=3]"/>
                         </fo:block>
    <fo:block text-indent="19mm">
                    <xsl:apply-templates select="addrLine[position()=4]"/>
                         </fo:block>
    </xsl:template>
    
    <xsl:template match="hi[@rend='double_u']">
        <fo:block border-style= 'double'><xsl:apply-templates /></fo:block>>
    </xsl:template>
    
    
    <xsl:template match="note//title">
        <fo:inline font-style="italic"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="ps">
        <fo:block>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="lb">
        <fo:block>
        <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="gap">
        <fo:inline>
        [...]<xsl:apply-templates />
            </fo:inline>
    </xsl:template>
    
    <xsl:template match="//note[@place='in-text']">
        <xsl:apply-templates/>
    </xsl:template>  
    
    <xsl:template match="//hi[@rend='underlined']">
        <fo:inline text-decoration="underline"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="//print">
        <fo:inline font-style="italic"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="//hi[@rend='italic']">
        <fo:inline font-style="italic"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="hi[@rend='apice']">
        <fo:inline vertical-align="super"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="hi[@rend='underl_sup']">
        <fo:inline text-decoration="underline" vertical-align="super"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="add[@place='marginright']">
        <fo:block>[a margine destro:] <xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="add[@place='marginleft']">
        <fo:block>[a margine sinistro:] <xsl:apply-templates /></fo:block>
    </xsl:template>
    
    
    <xsl:template match="add[@place='margintop']">
        <fo:block>[a margine superiore del foglio:] <xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="add[@place='margintop1']">
        <fo:block>[a margine superiore della prima facciata:] <xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="add[@place='marginbot']">
        <fo:block>[a margine inferiore del foglio:] <xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="add[@place='back']">
        <fo:block>[sul retro]: <xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="add[@place='supralinear']">
        <fo:inline vertical-align="super">[scritto sopra]:<xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="add[@place='underlinear']">
        <!--<i>sotto la linea: </i>--> <fo:inline vertical-align="sub"><xsl:apply-templates/></fo:inline>
    </xsl:template>
   
    <xsl:template match="//addrLine[@rend='underlined']">
        <fo:inline text-decoration="underline"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="title[@rend='underlined']">
        <fo:inline text-decoration="underline"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="placeName[@rend='underlined']">
        <fo:inline text-decoration="underline"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="hi[@rend='line']">
        <fo:block>
            <fo:leader 
                leader-length.minimum="12pt" leader-length.optimum="100%"
                leader-lenght.maximum="100%"
                leader-pattern="rule" 
                rule-thickness="0.1mm" 
                color="black"/>
        </fo:block>
    </xsl:template>
   
    <xsl:template match="hi[@rend='littleline']">
        <fo:block>
            <fo:leader 
                leader-lenght="100%" 
                leader-pattern="rule" 
                rule-style="solid" 
                rule-thickness="0.1mm" 
                color="black"><xsl:apply-templates/></fo:leader>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="del">
        <fo:inline text-decoration="line-through"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="body//p">
        <fo:block>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="p[@rend='right']|hi[@rend='right']">
        <fo:block text-align="right"><xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="p[@rend='center']|hi[@rend='center']">
        <fo:block text-align="center"><xsl:apply-templates /></fo:block>
    </xsl:template>
    
    <xsl:template match="name[@rend='italic']|persName[@rend='italic']|title[@rend='italic']">
        <fo:inline font-style="italic"><xsl:apply-templates/></fo:inline>
    </xsl:template>
    
    <xsl:template match="//expan">
        <fo:inline> [<xsl:apply-templates/>]</fo:inline>
    </xsl:template>
    
    <xsl:template match="add[@resp='CSGP']">
        <fo:inline>[<xsl:apply-templates />]</fo:inline> 
    </xsl:template>
    
    <xsl:template match="//seg[@type='Puccini Antonio']">
        <fo:inline><xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template match="//seg[@type='Anonymous']">
        <fo:inline><xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template match="//seg[@type='Bettolacci Antonio']">
        <fo:inline><xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template match="//seg[@type='Giurlani Carlo']">
        <fo:inline><xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template match="//seg[@type='Angeloni Carlo']">
        <fo:inline><xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template match="sic">
        <fo:inline>[sic]<xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template match="recte">
        <fo:inline>[recte]<xsl:apply-templates /></fo:inline>
    </xsl:template>
    
    <xsl:template name="datazione">
            <xsl:choose>
                <xsl:when test="//letHeading/placeLet[@attested='no'] and //letHeading/dateLet[@attested='no']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold">[<xsl:apply-templates select="//letDesc/letHeading/placeLet"/>, 
                    <xsl:apply-templates select="//letHeading/dateLet/date"/>]</fo:inline>
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='added'] and //letHeading/dateLet[@attested='yes']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold">[<xsl:apply-templates select="//letHeading/placeLet"/>], 
                        <xsl:apply-templates select="//letHeading/dateLet/date"/></fo:inline>
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='added'] or //letHeading/placeLet[@attested='no'] and //letHeading/dateLet[@attested='added'] or //letHeading/dateLet[@attested='no']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold">[<xsl:apply-templates select="//letHeading/placeLet"/>, 
                      <xsl:apply-templates select="//letHeading/dateLet/date"/>]</fo:inline>
                    
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='unk'] and //letHeading/dateLet[@attested='added'] or //letHeading/dateLet[@attested='no']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold">[<xsl:apply-templates select="//letHeading/dateLet/date"/>]</fo:inline>
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='yes'] and //letHeading/dateLet[@attested='yes']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold"><xsl:apply-templates select="//letDesc/letHeading/placeLet"/>, 
                        <xsl:apply-templates select="//letHeading/dateLet/date"/></fo:inline> 
                </xsl:when>
                
                
                <xsl:when test="//letHeading/placeLet[@attested='unk'] and //letDesc/letHeading/DateLet[@attested='unk']">
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='added'] or //letHeading/placeLet[@attested='no'] and //letHeading/dateLet[@attested='unk']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold">[<xsl:apply-templates select="//letHeading/placeLet"/>]</fo:inline>
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='unk'] and //letHeading/dateLet[@attested='yes']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold"><xsl:apply-templates select="//letHeading/dateLet/date"/></fo:inline>
                </xsl:when>
                
                <xsl:when test="//letHeading/placeLet[@attested='yes'] and //letHeading/dateLet[@attested='unk']">
                    
                    <fo:leader leader-pattern="none" leader-length.minimum="12pt" leader-length.optimum="25%"
                        leader-length.maximum="100%"/>
                    
                    <fo:inline font-weight="bold"><xsl:apply-templates select="//letHeading/placeLet"/></fo:inline>
                </xsl:when>
                
            </xsl:choose>	
        
    </xsl:template>
    
</xsl:stylesheet>