<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="dynalist.xsl"/>
  <xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
  <xsl:template match="Richtext">
    <xsl:choose>
      <xsl:when test="starts-with(../sTemplate,'Dyna')">
        <xsl:variable name="call">
          <xsl:value-of select="/ShowPage/SysURL"/>
          <xsl:text>?f=</xsl:text>
          <xsl:value-of select="../@id"/>
        </xsl:variable>
        <xsl:apply-templates select="document($call)/ShowPage" mode="dyna" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="ShowPage" mode="dyna">
    <xsl:apply-templates select="Richtext/*"/>
    <xsl:choose>
      <xsl:when test="@name='$Role$'">
        <xsl:apply-templates select="." mode="role"/>
      </xsl:when>
      <xsl:when test="@name='$User$'">
        <xsl:apply-templates select="." mode="user"/>
      </xsl:when>
      <xsl:when test="@name[.='indexmap' or .='indexsel' or .='tree' or .='move' or .='deltree']">
        <xsl:apply-templates select="." mode="map"/>
      </xsl:when>
      <xsl:when test="@name='todo' or @name='toread'">
        <xsl:apply-templates select="." mode="todo"/>
      </xsl:when>
      <xsl:when test="@name='sessions'">
        <xsl:apply-templates select="." mode="sessions"/>
      </xsl:when>
      <xsl:when test="@name='sysinfo'">
        <xsl:apply-templates select="." mode="sysinfo"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="others"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="ShowPage" mode="addstyle">
    <style type="text/css">
      td.ctrl a:hover {color:white; background-color:black; text-decoration:none}
    </style>
  </xsl:template>
  <xsl:template match="node()" mode="lang">
    <xsl:choose>
      <xsl:when test="count(@lang) > 0" />
      <xsl:when test="starts-with(/ShowPage/xCitePrefix,'参')">
        <xsl:attribute name="lang">zh-Hans</xsl:attribute>
      </xsl:when>
      <xsl:when test="starts-with(/ShowPage/xCitePrefix,'See')">
        <xsl:attribute name="lang">en</xsl:attribute>
      </xsl:when>
      <xsl:when test="starts-with(/ShowPage/xCitePrefix,'Vgl')">
        <xsl:attribute name="lang">de</xsl:attribute>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="table">
    <table class="{@class}">
      <xsl:apply-templates select="." mode="lang" />
      <xsl:apply-templates select="node() | @* " />
    </table>
  </xsl:template>
  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="ShowPage/Modus='combi'">
        <html>
          <head>
            <title>
              <xsl:value-of select="ShowPage/sTitle"/>
            </title>
          </head>
          <frameset cols="21%,*">
            <frame src="{ShowPage/Script}?f={ShowPage/@id}&amp;m=outline"/>
            <frame src="{ShowPage/Script}?f={ShowPage/Subobj/@id}&amp;param=nooutlinesynch" name="new_23"/>
          </frameset>
        </html>
      </xsl:when>
      <xsl:when test="ShowPage/param='random'">
        <html>
          <head>
            <style>

              .Aufgabe {font-size: 13px; font-family: Arial; font-weight: normal; margin-top: 1px; margin-bottom: 1px;}
              .SimpleT td, .st td {border-left: solid 1px black; border-top: solid 1px black; height: 16px; margin-left: 10px; font-family: Arial}
              .SimpleT, .st {border-right: solid 1px black; border-bottom: solid 1px black; border-collapse: collapse;}
            </style>
          </head>
          <body>
            <xsl:apply-templates select="/ShowPage/Subobj[1]/Richtext"/>
            <xsl:for-each select="//Subobj[count(Richtext//table[@class='Aufgabe'])=1]">
              <xsl:sort select="@random" data-type="number"/>
              <xsl:variable name="rnd" select="@random"/>
              <xsl:variable name="vor" select="sum(//Subobj[@random &lt; $rnd]/Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2])"/>
              <xsl:variable name="pnt" select=".//Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2]"/>
              <xsl:variable name="sum" select="$vor + $pnt"/>
              <xsl:variable name="pl">
                <xsl:choose>
                  <xsl:when test="count(/ShowPage/ListOption/@exampl)">
                    <xsl:value-of select="/ShowPage/ListOption/@exampl"/>
                  </xsl:when>
                  <xsl:otherwise>25</xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
              <xsl:variable name="p1" select="$pl - 6"/>
              <xsl:variable name="p2" select="$pl * 2 - 6"/>
              <xsl:variable name="p3" select="$pl * 3 - 6"/>
              <xsl:variable name="p4" select="$pl * 4 - 6"/>
              <xsl:variable name="p5" select="$pl * 5 - 6" />
              <xsl:choose>
                <xsl:when test="$vor &gt; /ShowPage/ListOption/@exam - 1"/>
                <xsl:when test="$sum &lt; /ShowPage/ListOption/@exam + 1">
                  <xsl:if test="$vor = 0 or ($vor &lt; ($p1 + 1) and $sum &gt; $p1) or ($vor &lt; ($p2 + 1) and $sum &gt; $p2) or 
                                            ($vor &lt; ($p3 + 1) and $sum &gt; $p3) or ($vor &lt; ($p4 + 1) and $sum &gt; $p4) or ($vor &lt; ($p5 + 1) and $sum &gt; $p5)">
                    <h1 class="Aufgabe" id="sec{@id}">
                      <xsl:value-of select="$lsBlock"/>
                    </h1>
                  </xsl:if>
                  <xsl:apply-templates select="." mode="pnt">
                    <xsl:with-param name="vor" select="$vor"/>
                  </xsl:apply-templates>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:call-template name="Rest">
                    <xsl:with-param name="rnd" select="$rnd"/>
                    <xsl:with-param name="vor" select="$vor"/>
                  </xsl:call-template>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:for-each>
          </body>
        </html>
      </xsl:when>
      <xsl:when test="ShowPage/Modus[.='outline' or .='all' or .='export']">
        <html>
          <xsl:apply-templates select="ShowPage" mode="lang" />
          <head>
            <xsl:if test="ShowPage/Modus!='outline'">
              <meta name="viewport" content="width=620"/>
            </xsl:if>
            <title>
              <xsl:value-of select="ShowPage/sTitle"/>
            </title>
            <meta name="TIMER">
              <xsl:attribute name="CONTENT">
                <xsl:value-of select="ShowPage/Timer"/>
              </xsl:attribute>
            </meta>
            <style>
              td {<xsl:value-of select="$ff"/>}
              @media screen and (min-width: 301px){
              .outline1, .outline2 {display:none;}
              }
              @media screen and (max-width: 300px){
              .outline3 {display:none;}
              }
            </style>
            <xsl:apply-templates select="//meta[@name='language'][1]" mode="copy" />
            <xsl:apply-templates select="//meta[@http-equiv='content-language'][1]" mode="copy" />
            <!--
				<xsl:if test="ShowPage/Modus='outline'">
					<meta http-equiv="refresh" content="60;"/>
				</xsl:if>
				-->
            <xsl:if test="/ShowPage[Modus != 'all' or ex != 'references']">
              <style type="text/css" media="screen">
                .Comment {text-decoration: none; background: #ffff88;}
                .Comment {text-decoration: none; background: #ffff88;}
                .CommentPink {text-decoration: none; background: #ff88ff;}
                .CommentGreen {text-decoration: none; background: #88ff88;}
                .Strike {text-decoration: line-through; color: red; border-left: solid 1px red; border-right: solid 1px red;}
                .Nodisplay, .Strike span.Nodisplay, .Comment span.Nodisplay
                {display: none; border: solid 1px black; background: #ccffcc;text-decoration:none;}
                .DoCopyBottom {color: black; border-bottom: solid 1px red;}
                .DoCopyThrough {color: red; text-decoration: line-through;}
                .DoCopyTop {color: black; border-top: solid 1px red;}
                .DoCopyHead {color: black; border-top: solid 1px red;border-bottom: solid 1px red;border-left: solid 1px red;}
              </style>
              <style type="text/css" media="print">
                .Comment {text-decoration: none; background: #ffff88; border: dotted 1pt #880000;}
                .CommentBlue {text-decoration: none; background: #aaaaff; border: dotted 1pt #880000;}
                .CommentPink {text-decoration: none; background: #ff88ff; border: dotted 1pt #880000;}
                .CommentGreen {text-decoration: none; background: #88ff88; border: dotted 1pt #880000;}
                .Strike {border-left: solid 1pt #880000; border-right: solid 1pt #880000;}
                .Nodisplay, .Strike span.Nodisplay, .Comment span.Nodisplay
                {display: inline; text-decoration: none; border: solid 1pt #cc0000; background: #ccffcc;}
                .DoCopyBottom {border-bottom: solid 1pt #880000;}
                .DoCopyThrough {color: #880000; text-decoration: line-through;}
                .DoCopyTop {border-top: solid 1pt #880000;}
                .DoCopyHead {border-top: solid 1pt red;border-bottom: solid 1pt red;border-left: solid 1pt #880000;}
              </style>
              <style type="text/css">
                #outline td {font-size: 12;}
                .Strike:hover, .StrikeOver {text-decoration: none; background: #cccccc; color: black; border-left: solid 1px red; border-right: solid 1px red;}
                .Comment:hover, .CommentOver {text-decoration: none; background: #cccccc; color: black}
                .Strike:hover span, .Comment:hover span, .StrikeOver span, .CommentOver span {text-decoration: line-under; display: inline; text-decoration: none; background: white; background: #ccffcc;color: black;}
                .NoComment {text-decoration: none; background: white;}
                .text { margin-top: -1.5em; margin-bottom: -2.0em;}
                BODY {font-size: 14px;}
                div {font-size: 14px;}
                p {font-size: 14px;}
                a:hover, a:hover p, a:hover h1, a:hover h2, a:hover h3, A:hover h4, A:hover h5, a:hover h6  {color:white; background-color:black; text-decoration:none}
                A {color:black; text-decoration:none}

                img.HoverEdit {display:none; position: relative; left: 0px; top: 0px;}
                p:hover img.HoverEdit {display:inline; background-color: white;}

                a.Footnote,a.CiteDir,a.CiteInd,a.CiteIndPlus {background: #66cdaa;}
                td {font-size: 14px;}

                p.standard{margin-top:6pt;margin-bottom: 6pt; text-align: justify}
                p.enum {font-size: 14px;  margin-top: 0pt; margin-bottom: 0pt;}
                p.DocTitle {font-family: arial;font-size: 18pt; margin-bottom: 18 pt;}
                h1, h2, h3, h4  { font-family: arial; font-weight: bold;}
                h1 {font-size: 14pt}
                h2, h3 {font-size: 12pt}
                h4 {font-size: 11pt}

                textarea.content {
                BORDER-RIGHT: 0px;
                BORDER-TOP: 0px;
                OVERFLOW-Y: visible;
                BORDER-LEFT: 0px;
                BORDER-BOTTOM: 0px;
                width: 100%;
                font-size: 14px;
                }
                .SimpleT td, .st td {border-left: solid 1px black; border-top: solid 1px black; height: 16px;}
                <xsl:choose>
                  <xsl:when test="/ShowPage/Modus='export'">
                    p.reference {margin-top:3pt;margin-bottom: 3pt; word-break0:break-all;}
                    .SimpleT, .st {border-right: solid 1px black; border-bottom: solid 1px black; border-collapse: collapse; margin-left: 4px;}
                  </xsl:when>
                  <xsl:otherwise>
                    p.reference {margin-top:3pt;margin-bottom: 3pt; }
                    .SimpleT, .st {border-right: solid 1px black; border-bottom: solid 1px black; border-collapse: collapse;}
                    span.xURL {word-break: break-all;}

                  </xsl:otherwise>
                </xsl:choose>
              </style>
              <xsl:apply-templates mode="richtextstyle"
      select="ShowPage/Subobj[position()=1]/Richtext/p/style|ShowPage/Richtext/style|ShowPage/style|ShowPage/Subobj[position()=1]/mRichtext/style|ShowPage/Subobj[position()=1]/Richtext/style"/>
            </xsl:if>

            <script language="JavaScript" type="text/javascript">
              <!--
						<xsl:if test="ShowPage/Modus='outline'">
										setTimeout("reload_outline",60000);
										function reload_outline(){				
											window.location.reload();
										}
						</xsl:if>
					-->
              function EditPage(id){
              if(document.location.href.match('m=all')!=null)
              document.location.href = '<xsl:value-of select="/ShowPage/Script"/>?f=<xsl:value-of select="/ShowPage/@id"/>&amp;m=all#ed'+id;
              //document.location.replace('<xsl:value-of select="/ShowPage/Script"/>?f=<xsl:value-of select="/ShowPage/@id"/>&amp;m=all#ed'+id);
              open('<xsl:value-of select="/ShowPage/Script"/>?m=edit&amp;f=' + id,'edit_' + id);


              }

              function OpenOutline(s){
              window.open('<xsl:value-of select="//ShowPage/Script"/><![CDATA[?f='+s+'&m=outline','Outline','width=280,left=0,scrollbars=yes,resizable=yes,toolbar=yes]]>');
              }
              function SpanHover(e,iMode){
              e.className = e.className.replace('Over','');
              if(iMode)e.className += 'Over';
              }
              function ShowThisPage(){
              <xsl:if test="count(/ShowPage/para) and /ShowPage/Modus='outline'">
                if(document.all.M<xsl:value-of select="/ShowPage/para"/> !=null)document.all.M<xsl:value-of select="/ShowPage/para"/>.scrollIntoView(true);
                window.scrollBy(0,-100);
              </xsl:if>
              if(document.location.href.match('#'))document.getElementById(document.location.href.split('#')[1]).scrollIntoView(true);
              window.focus();
              }
            </script>
          </head>
          <body onload="ShowThisPage();" id="Rootsection">
            <xsl:choose>
              <xsl:when test="ShowPage/Modus [. = 'all' or . = 'export']">
                <xsl:if test="ShowPage/ex != 'references'">
                  <xsl:apply-templates select="ShowPage/Subobj[position()=1]" mode="all">
                    <xsl:with-param name="Ebene">0</xsl:with-param>
                  </xsl:apply-templates>
                </xsl:if>

                <xsl:if test="count(ShowPage/Subobj) &gt; 1 and count(ShowPage/Subobj[position()=last()]/Subobj) + count(ShowPage/Subobj[position()=last()]/Richtext) + count(ShowPage/Subobj[position()=last()]/Richtext)> 0">
                  <xsl:apply-templates select="ShowPage/Subobj[position()=last()]" mode="ReferenceText"/>
                </xsl:if>
                <xsl:if test="ShowPage/Modus='export'">
                  <div style="mso-element:footnote-list">
                    <xsl:apply-templates select="//mRichtext|//Richtext" mode="footnote"/>
                  </div>
                </xsl:if>
              </xsl:when>
              <xsl:when test="ShowPage/Modus='outline'">
                <table id="outline" cellspacing="0" cellpadding="3">
                  <tbody>
                    <xsl:for-each select="ShowPage/Subobj">
                      <tr>
                        <td colspan="2">
                          <xsl:if test="count(mComment)>0">
                            <xsl:attribute name="bgcolor">yellow</xsl:attribute>
                          </xsl:if>
                          <a target="new_23" onclick="top.document.title='{sTitle}';" href="{/ShowPage/Script}?f={@id}">
                            <b>
                              <xsl:value-of select="sTitle"/>
                            </b>
                          </a>
                        </td>
                      </tr>
                      <xsl:choose>
                        <xsl:when test="position()=1">
                          <xsl:apply-templates select="." mode="outline">
                            <xsl:with-param name="Ebene">0</xsl:with-param>
                          </xsl:apply-templates>
                        </xsl:when>
                        <xsl:when test="position()=2 and position() &lt; last()">
                          <xsl:apply-templates select="." mode="Figures"/>
                        </xsl:when>
                        <xsl:when test="position()=last()">
                          <xsl:choose>
                            <xsl:when test="count(../xCiteMode)=0 or ../xCiteMode=''">
                              <xsl:apply-templates select="Subobj" mode="References"/>
                            </xsl:when>
                            <xsl:otherwise>
                              <xsl:apply-templates select="Subobj" mode="References">
                                <xsl:sort select="sTitle"/>
                              </xsl:apply-templates>
                            </xsl:otherwise>
                          </xsl:choose>
                        </xsl:when>
                      </xsl:choose>
                    </xsl:for-each>
                  </tbody>
                </table>
              </xsl:when>
            </xsl:choose>
          </body>
        </html>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="ShowPage" mode="block">
          <xsl:with-param name="hide" select="'append'"/>
        </xsl:apply-templates>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="Rest">
    <xsl:param name="vor"/>
    <xsl:param name="rnd"/>
    <xsl:variable name="diff" select="/ShowPage/ListOption/@exam - $vor"/>
    <xsl:variable name="rest" select="//Subobj[(count(Richtext//table[@class='Aufgabe'])=1) and 
				(@random &gt; $rnd) and 
				(Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2] = $diff)]"/>
    <xsl:choose>
      <xsl:when test="count($rest) &gt; 0">
        <xsl:apply-templates select="$rest[1]" mode="pnt">
          <xsl:with-param name="vor" select="$vor"/>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="choice" select="//Subobj[(count(Richtext//table[@class='Aufgabe'])=1) and 
				        (@random &gt; $rnd - 1) ]"/>
        <xsl:for-each select="$choice">
          <xsl:sort select="@random" data-type="number"/>
          <xsl:variable name="rnd1" select="@random"/>
          <xsl:variable name="vor1" select="sum(//Subobj[@random &lt; $rnd1]/Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2])"/>
          <xsl:apply-templates select="." mode="pnt">
            <xsl:with-param name="vor" select="$vor1" />
            <xsl:with-param name="warning" select="1"/>
          </xsl:apply-templates>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="Subobj" mode="pnt">
    <xsl:param name="vor"/>
    <xsl:param name="warning" select="0"/>
    <xsl:variable name="pnt" select="Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2]"/>
    <xsl:variable name="id">
      <xsl:choose>
        <xsl:when test="sTemplate = 'Xtern' and count(Status[@class='ActiveLink'])">
          <xsl:value-of select="Status/@link"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@id"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <h2 class="Aufgabe" id="{$id}" title="{$pnt}">
      <a href="{/ShowPage/Script}?f={$id}" target="_blank">
        <xsl:if test="$warning">
          <xsl:attribute name="style">background-color: #ffcccc;</xsl:attribute>
        </xsl:if>
        <xsl:value-of select="sTitle"/>
        <xsl:text> (</xsl:text>
        <xsl:value-of select="$pnt"/>
        <xsl:text>|</xsl:text>
        <xsl:value-of select="$vor + $pnt"/>
        <xsl:text>)</xsl:text>
      </a>
    </h2>
  </xsl:template>
  <xsl:template match="ShowPage" mode="NoTitleAdd">
    <input type="hidden" name="sTemplate" value="RootSection.xsl"/>
    <!-- optional -->
    <input type="hidden" name="mRichtext">
      <xsl:attribute name="value">
        <xsl:value-of select="Richtext"/>
      </xsl:attribute>
    </input>
    <!-- Ende -->
  </xsl:template>
  <xsl:template match="ShowPage" mode="Untergeordnet">
    <xsl:apply-templates select="." mode="NoTitle"/>
    <xsl:if test="count(sTitle)">

      <script language="JavaScript" type="text/javascript">
        function OpenOutline(s){
        window.open('<xsl:value-of select="//ShowPage/Script"/><![CDATA[?f='+s+'&m=outline','Outline','width=280,left=0,scrollbars=yes,resizable=yes,toolbar=yes,googlebar=no]]>');
        }
      </script>

      <form method="post" action="{Script}?f={@id}&amp;m=update" id="editor" target="lock">
        <table border="0" cellspacing="3" cellpadding="0">
          <tr id="trMainText">
            <td/>
            <td>
              <xsl:value-of select="$lsMain"/>
            </td>
            <xsl:choose>
              <xsl:when test="count(Subobj)=0">
                <td>
                  <a href="{//ShowPage/Script}?f={@id}&amp;m=create&amp;v=Section.xsl">
                    <xsl:value-of select="$lsAdd"/>
                  </a>
                  <xsl:text> </xsl:text>
                  <a href="{//ShowPage/Script}?f={@id}&amp;m=update&amp;next=NewXtern">
                    <xsl:value-of select="$lsAppendLink"/>
                  </a>
                </td>
              </xsl:when>
              <xsl:otherwise>
                <xsl:apply-templates select="Subobj[position()=1]" mode="Component"/>
              </xsl:otherwise>
            </xsl:choose>
          </tr>
          <xsl:if test="count(Subobj) &gt; 2">
            <tr id="trEtc">
              <td/>
              <td>
                <xsl:value-of select="$lsEtc"/>
              </td>
              <xsl:apply-templates select="Subobj[position()=2]" mode="Component"/>
            </tr>
          </xsl:if>
          <tr id="trRef">
            <td/>
            <td>
              <xsl:value-of select="$lsReferences"/>
            </td>
            <xsl:choose>
              <xsl:when test="count(Subobj)=1">
                <td class="ctrl">
                  <a>
                    <xsl:attribute name="href">
                      <xsl:value-of select="//ShowPage/Script"/>
                      <xsl:text>?f=</xsl:text>
                      <xsl:value-of select="@id"/>
                      <xsl:text>&amp;m=create&amp;v=NextBib.xsl</xsl:text>
                    </xsl:attribute>
                    <xsl:value-of select="$lsAdd"/>
                  </a>
                </td>
              </xsl:when>
              <xsl:otherwise>
                <xsl:apply-templates select="Subobj[position()=last()]" mode="Component"/>
              </xsl:otherwise>
            </xsl:choose>
          </tr>
          <tr class="trSpacer">
            <td>
              <br/>
            </td>
          </tr>
          <tr id="trCiteForm">
            <td/>
            <td style="white-space: nowrap;">
              <xsl:value-of select="$lsCiteMode"/>:
            </td>
            <td>
              <input type="hidden" name="xBodyFields" value="xCiteMode,xCitePrefix,xSectionNumber,xWordProc"/>
              <input type="hidden" name="sTitle" value="{/ShowPage/sTitle}"/>
              <select name="xCiteMode" style="width: 160px;">
                <option/>
                <!--
                                    <option value="short">
                                        <xsl:if test="/ShowPage/xCiteMode='short'">
                                            <xsl:attribute name="selected"/>
                                        </xsl:if>
                                        <xsl:value-of select="$lsShort"/>
                                    </option>
                                    <option value="inline">
                                        <xsl:if test="/ShowPage/xCiteMode='inline'">
                                            <xsl:attribute name="selected"/>
                                        </xsl:if>
                                        <xsl:value-of select="$lsInline"/>
                                    </option>                                    
                                    -->
                <option value="shorty">
                  <xsl:if test="/ShowPage/xCiteMode='shorty'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsShortY"/>
                </option>
                <option value="long">
                  <xsl:if test="/ShowPage/xCiteMode='long'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsLong"/>
                </option>

                <option value="inlineN">
                  <xsl:if test="/ShowPage/xCiteMode='inlineN'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsInlineN"/>
                </option>
                <option value="inlineNA">
                  <xsl:if test="/ShowPage/xCiteMode='inlineNA'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsInlineNA"/>
                </option>
                <option value="inliney">
                  <xsl:if test="/ShowPage/xCiteMode='inliney'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsInlineY"/>
                </option>
                <option value="inlinea">
                  <xsl:if test="/ShowPage/xCiteMode='inlinea'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsInlineA"/>
                </option>
                <option value="inlineLNI">
                  <xsl:if test="/ShowPage/xCiteMode='inlineLNI'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:text>LNI</xsl:text>
                </option>
              </select>
            </td>
          </tr>
          <tr id="trCiteLang">
            <td/>
            <td>
              <xsl:value-of select="$lsCitePrefix"/>:
            </td>
            <td>
              <select name="xCitePrefix" style="width: 160px;">
                <option/>
                <xsl:if test="xCitePrefix!=''">
                  <option selected="selected" value="{xCitePrefix}">
                    <xsl:value-of select="substring-before(xCitePrefix,'|')"/>|<xsl:value-of select="substring-before(substring-after(xCitePrefix,'|'),'|')"/>
                  </option>
                </xsl:if>
                <option value="Vgl. |Vgl. u.a. |vgl. |vgl. u.a. ">Vgl. |Vgl. u.a.</option>
                <option value="See |See, e.g., |see |see, e.g., ">See |See, e.g.,</option>
                <option value="参见：|如参见：|参见：|如参见：">参见：|如参见：</option>
                <option value="|||">-</option>
              </select>
            </td>
          </tr>
          <tr id="trWP">
            <td/>
            <td>
              <xsl:value-of select="$lsWP"/>:
            </td>
            <td>
              <select name="xWordProc" style="width: 160px;">
                <option value="WORD2007">
                  <xsl:if test="/ShowPage/xWordProc='WORD2007'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:text>Microsoft Word 2007</xsl:text>
                </option>
                <option value="OOff30">
                  <xsl:if test="/ShowPage/xWordProc='OOff30'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:text>OpenOffice.org 3.0</xsl:text>
                </option>
                <option value="WORD">
                  <xsl:if test="/ShowPage/xWordProc='WORD'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:text>Microsoft Word 2000</xsl:text>
                </option>
              </select>
            </td>
          </tr>
          <tr id="trSectionSubmit">
            <td/>
            <td>
              <xsl:value-of select="$lsSectionNumber"/>:
            </td>
            <td>
              <select name="xSectionNumber" style="width: 160px;">
                <option/>
                <option value="standard">
                  <xsl:if test="/ShowPage/xSectionNumber='standard'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsStandard"/>
                </option>
                <option value="none">
                  <xsl:if test="/ShowPage/xSectionNumber='none'">
                    <xsl:attribute name="selected"/>
                  </xsl:if>
                  <xsl:value-of select="$lsNone"/>
                </option>
              </select>
              <input type="submit" value="{$lsSubmit}"/>
              <input type="hidden" name="next" value="show_{@id}&amp;m=settings"/>
              <iframe name="lock" frameborder="0" width="2" height="2"/>
              <input type="hidden" name="bSave" value="bSave"/>
              <input type="hidden" name="sTemplate" value="RootSection.xsl"/>
            </td>
          </tr>
          <tr class="trSpacer">
            <td>
              <br/>
            </td>
          </tr>
          <tr id="trDisplay" valign="top">
            <td/>
            <td>
              <xsl:value-of select="$lsView"/>:
            </td>
            <td colspan="2" class="ctrl">
              <a target="doc{@id}" href="{//ShowPage/Script}?f={@id}&amp;m=all">
                <xsl:value-of select="$lsEntireDoc"/>
              </a>
              <xsl:text> </xsl:text>
              <a href="javascript:OpenOutline('{@id}')">
                <xsl:value-of select="$lsOutline"/>
              </a>
              <xsl:text> </xsl:text>
              <a target="combi{@id}" href="{//ShowPage/Script}?f={@id}&amp;m=combi">
                <xsl:value-of select="$lsCombined"/>
              </a>
              <xsl:text> </xsl:text>
              <a target="doc{@id}" href="{//ShowPage/Script}?f={@id}&amp;m=all&amp;ex=references">
                <xsl:value-of select="$lsShowReferences"/>
              </a>
            </td>
          </tr>
          <tr id="trExport">
            <td />
            <td>
              <xsl:value-of select="$lsExport"/>:
            </td>

            <td colspan="2" class="ctrl">
              <a target="export" href="{/ShowPage/Script}?f={@id}&amp;m=export&amp;device=IE40&amp;INFO={/ShowPage/INFO}">
                <xsl:value-of select="$lsWP"/>
              </a>
              <xsl:text> </xsl:text>
              <a target="export" href="{/ShowPage/Script}?f={@id}&amp;m=export&amp;param=strict&amp;device=IE40&amp;INFO={/ShowPage/INFO}">
                <xsl:value-of select="$lsWPStrict"/>
              </a>
              <xsl:text> </xsl:text>
              <a href="{/ShowPage/Script}?f={@id}&amp;m=ticket&amp;v=rootsection.xsl">Xcp-CAS</a>
              <xsl:if test="count(/ShowPage/ListOption/@exam)">
                <xsl:text> </xsl:text>
                <a target="_blank" href="{//ShowPage/Script}?f={@id}&amp;m=all&amp;param=random">
                  <xsl:value-of select="$lsExam"/>
                </a>
              </xsl:if>
              <xsl:text> </xsl:text>
              <a target="export">
                <xsl:attribute name="href">
                  <xsl:choose>
                    <xsl:when test="/ShowPage/Agent[.='Chrome' or .='FireFox']">
                      <xsl:text>view-source:</xsl:text>
                      <xsl:value-of select="/ShowPage/SysURL"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="/ShowPage/Script"/>
                    </xsl:otherwise>
                  </xsl:choose>
                  <xsl:text>?f=</xsl:text>
                  <xsl:value-of select="@id"/>
                  <xsl:text>&amp;m=export&amp;v=tex.xsl&amp;device=IE40</xsl:text>
                </xsl:attribute>
                <xsl:value-of select="$lsLaTeX"/>
              </a>
              <xsl:text> </xsl:text>
              <a target="export">
                <xsl:attribute name="href">
                  <xsl:choose>
                    <xsl:when test="/ShowPage/Agent[.='Chrome' or .='FireFox']">
                      <xsl:text>view-source:</xsl:text>
                      <xsl:value-of select="/ShowPage/SysURL"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="/ShowPage/Script"/>
                    </xsl:otherwise>
                  </xsl:choose>
                  <xsl:text>?f=</xsl:text>
                  <xsl:value-of select="@id"/>
                  <xsl:text>&amp;m=export&amp;v=bibtex.xsl&amp;device=IE40</xsl:text>
                </xsl:attribute>
                <xsl:value-of select="$lsBibTeX"/>
              </a>
            </td>
          </tr>
          <tr id="trImport">
            <td />
            <td>
              <xsl:value-of select="$lsImport"/>
              <xsl:text>: </xsl:text>
            </td>
            <td colspan="2" class="ctrl">
              <a href="addtree.aspx?f={@super}">Xcp-CAS</a>
            </td>
          </tr>
        </table>
      </form>
    </xsl:if>
  </xsl:template>
  <xsl:template match="Subobj" mode="Component">
    <td class="ctrl">
      <a href="{//ShowPage/Script}?f={@id}">
        <xsl:if test="sTitle = '' or count(sTitle)=0">
          <img border="0" src="{//ShowPage/ImgDir}page.gif"/>
        </xsl:if>
        <xsl:value-of select="sTitle"/>
      </a>
      <xsl:text> </xsl:text>
      <xsl:apply-templates select="." mode="Status"/>
    </td>
  </xsl:template>
  <xsl:template match="mRichtext|Richtext" mode="footnote">
    <xsl:for-each select="descendant-or-self::a">
      <xsl:choose>
        <xsl:when test="/ShowPage/xWordProc = 'OOff30' and (@class='Footnote' or (not(starts-with(/ShowPage/xCiteMode,'inline')) and @class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']))">
          <div id="sdfootnote1" class="Footnote">
            <p class="sdfootnote">
              <a class="sdfootnotesym" name="sdfootnote1sym" href="#sdfootnote1anc">1</a>
              <xsl:apply-templates select="." mode="Footnote"/>
            </p>
          </div>
        </xsl:when>
        <xsl:when test="@class='Footnote' or (not(starts-with(/ShowPage/xCiteMode,'inline')) and @class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'])">
          <div style="mso-element:footnote" id="ftnx" class="Footnote">
            <p class="MsoFootnoteText">
              <sup>
                <a style="mso-footnote-id:ftnx" href="#_ftnrefx" name="_ftnx">
                  <span class="MsoFootnoteReference">
                    <span style="mso-special-character:footnote"/>
                  </span>
                </a>
              </sup>
              <span>
                <font color="white">
                  <sup>.</sup>
                </font>
                <xsl:text> </xsl:text>
                <xsl:apply-templates select="." mode="Footnote">
                  <xsl:with-param name="fmt" select="'FootnoteFT'" />
                </xsl:apply-templates>
              </span>
            </p>
          </div>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:for-each select="descendant-or-self::div">
      <xsl:if test="substring(@id,1,3)='ftn'">
        <div style="mso-element:footnote" id="ftnx">
          <p class="MsoFootnoteText">
            <a style="mso-footnote-id:ftnx" href="#_ftnrefx" name="_ftnx">
              <span class="MsoFootnoteReference">
                <span style="mso-special-character:footnote"/>
              </span>
            </a>
            <span>
              <font color="white">
                <sup>.</sup>
              </font>
              <xsl:text> </xsl:text>
              <xsl:apply-templates select="div|p" mode="noa1"/>
            </span>
          </p>
        </div>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="div|p" mode="noa1">
    <xsl:for-each select="node()">
      <xsl:choose>
        <xsl:when test="position()=1"/>
        <xsl:otherwise>
          <xsl:apply-templates select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="Subobj">
    <tr VALIGN="top">
      <td align="left" width="23">
        <xsl:choose>
          <xsl:when test="sTemplate[.='Empty']">
            <br/>
          </xsl:when>
          <xsl:otherwise>
            <a>
              <xsl:attribute name="target">
                <xsl:value-of select="../Target"/>
              </xsl:attribute>
              <xsl:attribute name="href">
                <xsl:value-of select="Link"/>
              </xsl:attribute>
              <img border="0">
                <xsl:attribute name="src">
                  <xsl:value-of select="../ImgDir"/>
                  <xsl:text>punkt.gif</xsl:text>
                </xsl:attribute>
              </img>
            </a>
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td>
        <font size="2">
          <b>
            <xsl:value-of select="sTitle"/>
          </b>
        </font>
      </td>
    </tr>
  </xsl:template>
  <xsl:template match="ShowPage|Subobj" mode="all">
    <xsl:param name="Ebene"/>
    <xsl:param name="Index"/>
    <xsl:param name="Script">
      <xsl:value-of select="//ShowPage/Script"/>
    </xsl:param>
    <xsl:variable name="Title">
      <xsl:choose>
        <xsl:when test="mComment/MainTitle != ''">
          <xsl:value-of select="mComment[position()=last()]/MainTitle" disable-output-escaping="yes"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="sTitle" mode="Longtitle"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!-- ======================== Title ====================== -->
    <a name="ed{@id}" id="ed{@id}"/>
    <xsl:choose>
      <xsl:when test="/ShowPage/Modus='all' and count(/ShowPage/Edit)">
        <xsl:choose>
          <xsl:when test="sTemplate='NoTitle.xsl' or ../sTemplate = 'Glossary.xsl'"/>
          <xsl:when test="$Ebene &gt; 0 and $Ebene &lt; 7">
            <xsl:element name="{concat('H',$Ebene)}">
              <xsl:attribute name="id">
                <xsl:text>sec</xsl:text>
                <xsl:value-of select="@id"/>
              </xsl:attribute>
              <a href="javascript:EditPage('{@id}')">
                <xsl:if test="sTemplate!='NoSection.xsl' and (count(/ShowPage/Body/xSectionNumber)=0 or /ShowPage/Body/xSectionNumber!='none')">
                  <xsl:value-of select="Section"/>
                  <xsl:text> </xsl:text>
                </xsl:if>
                <xsl:value-of select="$Title" disable-output-escaping="yes"/>
              </a>
            </xsl:element>
          </xsl:when>
          <xsl:otherwise>
            <p class="DocTitle">
              <a href="javascript:EditPage('{@id}')">
                <xsl:apply-templates select="sTitle" mode="Longtitle"/>
              </a>
            </p>
          </xsl:otherwise>
        </xsl:choose>
        <!-- ============== Comment ================= -->
        <xsl:for-each select="mComment/Text">
          <div>
            <xsl:attribute name="id">
              <xsl:text>cb</xsl:text>
              <xsl:value-of select="@id"/>
            </xsl:attribute>
            <xsl:attribute name="style">
              <xsl:text>background-color:cccc80;</xsl:text>
              <xsl:text>width: 300px; border-width: 1px; border-style: solid; z-index: </xsl:text>
              <xsl:value-of select="@id"/>
              <xsl:text>; overflow: visible;</xsl:text>
            </xsl:attribute>
            <table border="0" width="100%" cellpadding="0" cellspacing="0">
              <tr valign="top">
                <td width="1" style="font-size: 11px;"/>
                <td style="font-size: 11px; color: black;">
                  <xsl:choose>
                    <xsl:when test="starts-with(@user,'Polling') and contains(@user,'_')">
                      <xsl:value-of select="substring-after(@user,'_')"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@user"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </td>
                <td align="right" style="font-size: 11px; color: black;">
                  <xsl:value-of select="@time"/>
                </td>
                <td width="1" style="font-size: 11px;"/>
              </tr>
              <tr>
                <td width="1" style="font-size: 11px;"/>
                <td colspan="3" style="background-color: yellow; font-size: 11px; ">
                  <xsl:apply-templates select="node()"/>
                </td>
                <td width="1" style="font-size: 11px;"/>
              </tr>
            </table>
          </div>
        </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="sTemplate='NoTitle.xsl' or ../sTemplate = 'Glossary.xsl'"/>
          <xsl:when test="$Ebene=1 or $Ebene=2 or $Ebene=3 or $Ebene=4 or $Ebene=5 or $Ebene=6">
            <a name="xcp_{@id}"/>
            <xsl:element name="H{$Ebene}">
              <xsl:attribute name="id">
                <xsl:text>sec</xsl:text>
                <xsl:value-of select="@id"/>
              </xsl:attribute>
              <xsl:if test="/ShowPage/Body/xWordProc[.='WORD2007' or .='OOff30'] and sTemplate!='NoSection.xsl' and (count(/ShowPage/Body/xSectionNumber)=0 or /ShowPage/Body/xSectionNumber!='none')">
                <xsl:value-of select="Section"/>
                <xsl:text> </xsl:text>
              </xsl:if>
              <xsl:apply-templates select="sTitle" mode="Longtitle"/>
            </xsl:element>
          </xsl:when>
          <xsl:otherwise>
            <p class="DocTitle">
              <a name="xcp_{@id}"/>
              <xsl:apply-templates select="sTitle" mode="Longtitle"/>
            </p>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
    <!-- ==================== Body ===================-->
    <xsl:choose>
      <xsl:when test="sTemplate='Xtern' and contains(Link,concat($Script,'?'))">
        <xsl:apply-templates select="document(Link)/ShowPage/mRichtext"/>
        <xsl:apply-templates select="document(Link)/ShowPage/Richtext"/>
        <xsl:apply-templates select="document(Link)/ShowPage/Body"/>
        <xsl:apply-templates select="document(concat(Link,'&amp;m=all'))/ShowPage/Subobj" mode="all">
          <xsl:with-param name="Ebene">
            <xsl:value-of select="$Ebene + 1 "/>
          </xsl:with-param>
          <xsl:with-param name="Index">
            <xsl:choose>
              <xsl:when test="$Ebene=0"/>
              <xsl:otherwise>
                <xsl:value-of select="concat($Index,position(),'.')"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:with-param>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="mComment/MainText != '' and //ShowPage/Modus!='export'">
            <xsl:value-of select="mComment[position()=last()]/MainText" disable-output-escaping="yes"/>
          </xsl:when>
          <xsl:when test="../sTemplate = 'Glossary.xsl'">
            <xsl:choose>
              <xsl:when test="count(Richtext//table[@class='glossary'])">
                <tr>
                  <td class="glossarytitle">
                    <xsl:if test="count(Richtext//table[@class='glossary']/tbody/tr)>1">
                      <xsl:attribute name="rowspan">
                        <xsl:value-of select="count(Richtext//table[@class='glossary']/tbody/tr)"/>
                      </xsl:attribute>
                    </xsl:if>
                    <xsl:choose>
                      <xsl:when test="count(/ShowPage/Edit)">
                        <a href="javascript:EditPage('{@id}')">
                          <xsl:value-of select="$Title"/>
                        </a>
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="$Title"/>
                      </xsl:otherwise>
                    </xsl:choose>
                    <a id="{$Title}" name="{$Title}" />
                  </td>
                  <xsl:apply-templates select="Richtext//table[@class='glossary']/tbody/tr[1]/td[1]" mode="glossaryentry"/>
                  <xsl:apply-templates select="Richtext//table[@class='glossary']/tbody/tr[1]/td[position() &gt; 1]"/>
                </tr>
                <xsl:for-each select="Richtext//table[@class='glossary']/tbody/tr[position() &gt; 1]" >
                  <tr>
                    <xsl:apply-templates select="td[1]" mode="glossaryentry"/>
                    <xsl:apply-templates select="td[position() &gt; 1]"/>
                  </tr>
                </xsl:for-each>
              </xsl:when>
              <xsl:otherwise>
                <tr>
                  <td class="glossarytitle">
                    <xsl:if test="count(Richtext//table[@class='glossary']/tbody/tr)>1">
                      <xsl:attribute name="rowspan">
                        <xsl:value-of select="count(Richtext//table[@class='glossary']/tbody/tr)"/>
                      </xsl:attribute>
                    </xsl:if>
                    <xsl:choose>
                      <xsl:when test="count(/ShowPage/Edit)">
                        <a href="javascript:EditPage('{@id}')">
                          <xsl:value-of select="$Title"/>
                        </a>
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="$Title"/>
                      </xsl:otherwise>
                    </xsl:choose>
                    <a id="{$Title}" name="{$Title}" />
                  </td>
                  <td class="glossaryentry">
                    <xsl:apply-templates select="mRichtext[1]"/>
                    <xsl:apply-templates select="Richtext"/>
                    <xsl:apply-templates select="Body"/>
                  </td>
                </tr>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates select="mRichtext[1]"/>
            <xsl:apply-templates select="Richtext"/>
            <xsl:apply-templates select="Body"/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:choose>
          <xsl:when test="sTemplate='Glossary.xsl' and ../sTemplate != 'Glossary.xsl'">
            <table class="glossarytext" border="0" cellspacing="0" cellpadding="0">
              <tbody>
                <xsl:apply-templates select="Subobj[sTemplate!='PrivateFile']" mode="all">
                  <xsl:sort select="sTitle" data-type="text"/>
                </xsl:apply-templates>
              </tbody>
            </table>
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates select="Subobj[sTemplate!='PrivateFile']" mode="all">
              <xsl:with-param name="Ebene">
                <xsl:value-of select="$Ebene + 1 "/>
              </xsl:with-param>
              <xsl:with-param name="Index">
                <xsl:choose>
                  <xsl:when test="$Ebene=0"/>
                  <xsl:otherwise>
                    <xsl:value-of select="concat($Index,position(),'.')"/>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:with-param>
            </xsl:apply-templates>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="td" mode="glossaryentry">
    <td class="glossaryentry">
      <xsl:apply-templates />
    </td>
  </xsl:template>
  <xsl:template match="sTitle" mode="Longtitle">
    <xsl:choose>
      <xsl:when test="count(../mRichtext//table[@name='coverpage'])"/>
      <xsl:when test="count(../Body/Longtitle)">
        <xsl:apply-templates select="../Body/Longtitle"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="."/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="ShowPage|Subobj" mode="outline2">
    <a target="new_23" onclick="top.document.title='{Section} {sTitle}';" href="{/ShowPage/Script}?f={@id}" title="{@time}">
      <xsl:value-of select="sTitle"/>
    </a>
    <xsl:apply-templates select="." mode="Status">
      <xsl:with-param name="target" select="'new_23'"/>
    </xsl:apply-templates>
  </xsl:template>
  <xsl:template match="ShowPage|Subobj" mode="outline1">
    <xsl:variable name="des">
      <xsl:value-of select="count(descendant::Subobj[count(Section) &gt; 0])"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$des &lt; 8">
        <xsl:if test="following::Subobj[count(Section) &gt; 0][8 - $des]/@id = /ShowPage/para">
          <a name="focus"/>
        </xsl:if>
      </xsl:when>
      <xsl:when test="descendant::Subobj[count(Section) &gt; 0][8]/@id = /ShowPage/para">
        <a name="focus"/>
      </xsl:when>
    </xsl:choose>
    <a href="javascript:EditPage('{@id}');" onclick="top.document.title='{$lsEdit} {Section} {sTitle}';" title="{$lsEditPage}">
      <xsl:choose>
        <xsl:when test="sTemplate[.='NoSection.xsl' or .='NoTitle.xsl']">-</xsl:when>
        <xsl:when test="/ShowPage/xSectionNumber='none'">-</xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="Section"/>
        </xsl:otherwise>
      </xsl:choose>
    </a>
  </xsl:template>
  <xsl:template match="ShowPage|Subobj" mode="outline">
    <xsl:param name="Ebene"/>
    <xsl:param name="Index"/>
    <xsl:param name="Script">
      <xsl:value-of select="//ShowPage/Script"/>
    </xsl:param>
    <xsl:if test="$Ebene != 0">
      <tr valign="top">
        <xsl:choose>
          <xsl:when test="@id=/ShowPage/para">
            <xsl:attribute name="bgcolor">#cccccc</xsl:attribute>
            <xsl:attribute name="id">
              <xsl:text>M</xsl:text>
              <xsl:value-of select="@id"/>
            </xsl:attribute>
          </xsl:when>
          <xsl:when test="count(mComment)>0">
            <xsl:attribute name="bgcolor">yellow</xsl:attribute>
          </xsl:when>
        </xsl:choose>
        <td class="outline1">
          <xsl:apply-templates select="." mode="outline1"/>
        </td>
        <td class="outline2">
          <xsl:apply-templates select="." mode="outline2"/>
        </td>
        <td class="outline3" style="padding-left: {$Ebene * 15}px;" colspan="2">
          <xsl:apply-templates select="." mode="outline1"/>
          <xsl:text> </xsl:text>
          <xsl:apply-templates select="." mode="outline2"/>
        </td>
      </tr>
    </xsl:if>
    <xsl:choose>
      <xsl:when test="sTemplate='Xtern' and contains(Link,concat($Script,'?'))">
        <xsl:apply-templates select="document(concat(Link,'&amp;m=outline'))/ShowPage/Subobj" mode="outline">
          <xsl:with-param name="Ebene">
            <xsl:value-of select="$Ebene + 1"/>
          </xsl:with-param>
          <xsl:with-param name="Index">
            <xsl:choose>
              <xsl:when test="$Ebene=0"/>
              <xsl:otherwise>
                <xsl:value-of select="concat($Index,position(),'.')"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:with-param>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="Subobj[sTemplate!='PrivateFile']" mode="outline">
          <xsl:with-param name="Ebene">
            <xsl:value-of select="$Ebene + 1 "/>
          </xsl:with-param>
          <xsl:with-param name="Index">
            <xsl:choose>
              <xsl:when test="$Ebene=0"/>
              <xsl:otherwise>
                <xsl:value-of select="concat($Index,position(),'.')"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:with-param>
        </xsl:apply-templates>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="ShowPage/Subobj" mode="Figures">
    <xsl:for-each select="//a[@class='AutoNumFigTitle' or @class='AutoNumFig']">
      <tr valign="top">
        <td nowrap="yes">
          <a href="javascript:EditPage('{@id}');" onclick="top.document.title='{$lsEdit} Fig. {Number} {sTitle}';" title="{$lsEditPage}">
            <xsl:text>Fig. </xsl:text>
            <xsl:value-of select="position()"/>
          </a>
        </td>
        <td>
          <a target="new_23" href="{@href}&amp;v=imgview.xsl">
            <xsl:attribute name="onclick">
              <xsl:text>top.document.title='</xsl:text>
              <xsl:value-of select="."/>
              <xsl:text>';</xsl:text>
            </xsl:attribute>
            <xsl:value-of select="."/>
          </a>
        </td>
      </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="Subobj" mode="References">
    <tr valign="top">
      <td>
        <xsl:choose>
          <xsl:when test="count(../../xCiteMode)=0 or ../../xCiteMode=''">
            <a href="javascript:EditPage('{@id}');" title="{$lsEditPage}" onclick="top.document.title='{$lsEdit} [{Number}] {sTitle}';">
              <xsl:text>[</xsl:text>
              <xsl:value-of select="Number"/>
              <xsl:text>]</xsl:text>
            </a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>-</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td>
        <xsl:if test="count(mComment)>0">
          <xsl:attribute name="bgcolor">yellow</xsl:attribute>
        </xsl:if>
        <a>
          <a target="new_23">
            <xsl:attribute name="onclick">
              <xsl:text>top.document.title='</xsl:text>
              <xsl:value-of select="sTitle"/>
              <xsl:text>';</xsl:text>
            </xsl:attribute>
            <xsl:attribute name="href">
              <xsl:value-of select="//ShowPage/Script"/>
              <xsl:text>?f=</xsl:text>
              <xsl:value-of select="@id"/>
            </xsl:attribute>
            <xsl:value-of select="sTitle"/>
          </a>
        </a>
      </td>
    </tr>
  </xsl:template>
  <xsl:template match="Subobj" mode="CrossRef">
    <xsl:param name="id"/>
    <xsl:param name="mode"/>
    <xsl:if test="number($id)=number(@id) or number($id)=number(@link)">
      <xsl:choose>
        <xsl:when test="$mode='Title'">
          <xsl:value-of select="sTitle"/>
        </xsl:when>
        <xsl:when test="$mode='Number'">
          <xsl:value-of select="Number"/>
        </xsl:when>
        <xsl:when test="$mode='Section'">
          <xsl:choose>
            <xsl:when test="substring(Section,string-length(Section))='.'">
              <xsl:value-of select="substring(Section,1,string-length(Section)-1)"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="Section"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>
        <xsl:when test="$mode='SectionTitle'">
          <xsl:value-of select="Section"/>: <xsl:value-of select="sTitle"/>
        </xsl:when>
        <!--
                <xsl:when test="$mode='NumberTitle'">
                    <xsl:value-of select="Number"/>: <xsl:value-of select="sTitle"/>
                </xsl:when>

                -->
        <xsl:when test="$mode='NumFig'">
          <!--
					<span style="mso-field-code:'REF _Ref{@id + 100000000} \\\\h'"><xsl:value-of select="Number"/></span>
					-->
          <xsl:value-of select="Number"/>
        </xsl:when>
        <!--
                <xsl:when test="$mode='NumFigTitle'">
                    <span style="mso-field-code:'REF _Ref{@id + 100000000} \\\\h'">
                        <xsl:value-of select="Number"/>
                    </span>: <xsl:value-of select="sTitle"/>
                </xsl:when>
                -->
        <xsl:when test="$mode='AutoNumFigTitle'">
          <span style="mso-field-code: 'SEQ Abbildung \\\\* ARABIC'">
            <xsl:value-of select="Number"/>
          </span>: <xsl:value-of select="sTitle"/>
        </xsl:when>
        <xsl:when test="$mode='AutoNumFig'">
          <span style="mso-field-code: 'SEQ Abbildung \\\\* ARABIC'">
            <xsl:value-of select="Number"/>
          </span>
        </xsl:when>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <xsl:template match="a" mode="NumFig">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumFigTitle' or @class='AutoNumFig']">
      <xsl:if test="@href=$href">
        <xsl:value-of select="position()"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="a" mode="NumTab">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumTab']">
      <xsl:if test="@href=$href">
        <xsl:value-of select="position()"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="a" mode="NumFml">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumFml']">
      <xsl:if test="@href=$href">
        <xsl:value-of select="position()"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <!--
    <xsl:template match="a" mode="NumFigTitle">
        <xsl:param name="href" select="@href"/>
        <xsl:for-each select="//a[@class='AutoNumFigTitle']">
            <xsl:if test="@href=$href">
                <xsl:value-of select="position()"/>: <xsl:value-of select="."/>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
    -->
  <xsl:template match="a" mode="AutoNumFigTitle">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumFigTitle' or @class='AutoNumFig']">
      <xsl:if test="@href=$href">
        <span style="mso-field-code: 'SEQ Abbildung \\\\* ARABIC'">
          <xsl:value-of select="position()"/>
        </span>: <xsl:value-of select="."/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="a" mode="AutoNumFig">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumFigTitle' or @class='AutoNumFig']">
      <xsl:if test="@href=$href">
        <span style="mso-field-code: 'SEQ Abbildung \\\\* ARABIC'">
          <xsl:value-of select="position()"/>
        </span>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="a" mode="AutoNumTab">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumTab']">
      <xsl:if test="@href=$href">
        <span style="mso-field-code: 'SEQ Tabelle \\\\* ARABIC'">
          <xsl:value-of select="position()"/>
        </span>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="a" mode="AutoNumFml">
    <xsl:param name="href" select="@href"/>
    <xsl:for-each select="//a[@class='AutoNumFml']">
      <xsl:if test="@href=$href">
        <span style="mso-field-code: 'SEQ Formel \\\\* ARABIC'">
          <xsl:value-of select="position()"/>
        </span>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="lasttoken">
    <xsl:param name="test" />
    <xsl:param name="key" />
    <xsl:choose>
      <xsl:when test="not(contains($test,$key))">
        <xsl:value-of select="$test"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="lasttoken">
          <xsl:with-param name="test" select="substring-after($test,$key)"/>
          <xsl:with-param name="key" select="$key" />
        </xsl:call-template>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="bracket">
    <xsl:param name="test" />
    <xsl:param name="output" />
    <xsl:choose>
      <xsl:when test="$output=' ('">
        <xsl:variable name="last">
          <xsl:call-template name="lasttoken">
            <xsl:with-param name="test" select="$test"/>
            <xsl:with-param name="key" select="')'" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:if test="not(contains($last,'('))">
          <xsl:text> (</xsl:text>
        </xsl:if>
      </xsl:when>
      <xsl:when test="$output=' ['">
        <xsl:variable name="last">
          <xsl:call-template name="lasttoken">
            <xsl:with-param name="test" select="$test"/>
            <xsl:with-param name="key" select="']'" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:if test="not(contains($last,'['))">
          <xsl:text> [</xsl:text>
        </xsl:if>
      </xsl:when>
      <xsl:when test="$output=')'">
        <xsl:if test="string-length(substring-before(concat($test,'()'),')')) > string-length(substring-before(concat($test,'()'),'('))">
          <xsl:text>)</xsl:text>
        </xsl:if>
      </xsl:when>
      <xsl:when test="$output=']'">
        <xsl:if test="string-length(substring-before(concat($test,'[]'),']')) > string-length(substring-before(concat($test,'[]'),'['))">
          <xsl:text>]</xsl:text>
        </xsl:if>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="a">
    <xsl:param name="id" select="substring-after(@href,'f=')"/>
    <xsl:variable name="pres" select="preceding-sibling::node()"/>
    <xsl:variable name="pref" select="$pres[1]"/>

    <xsl:variable name="pre" select="preceding-sibling::node()[1]"/>
    <xsl:variable name="pre2" select="preceding-sibling::node()[2]"/>
    <xsl:variable name="pre2text" select="string-length(preceding-sibling::text()[1])" />

    <xsl:variable name="fol" select="following-sibling::node()[1]"/>
    <xsl:variable name="fol2" select="following-sibling::node()[2]"/>
    <span>
      <xsl:attribute name="class">
        <xsl:value-of select="substring(@class,1,4)"/>
      </xsl:attribute>
      <xsl:choose>
        <xsl:when test="@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and substring(/ShowPage/xCiteMode,1,6)='inline'">
          <!-- before the reference -->
          <xsl:choose>
            <xsl:when test="((name($pre)='a' and $pre/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']) 
                    or (name($pre)='' and $pre2text &lt; 3 and name($pre2)='a' and $pre2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'])) 
                    and (name($fol) != 'a' and name($fol2)!='a' and /ShowPage/xCiteMode[.='inlineNA'])">
              <xsl:text>-</xsl:text>
            </xsl:when>
            <xsl:when test="name($pre)='a' and $pre/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']"/>
            <xsl:when test="name($pre)='' and $pre2text &lt; 3 and name($pre2)='a' and $pre2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] "/>
            <xsl:when test="(name($pre)='a' or (string-length($pre)=1 and name($pre2)='a')) and ($pre/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] or $pre2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'])">
              <xsl:text> </xsl:text>
            </xsl:when>
            <xsl:when test="name($pref)='a' and $pref/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">
              <xsl:text> </xsl:text>
            </xsl:when>
            <xsl:when test="/ShowPage/xCiteMode[.='inlineLNI' or .= 'inlineN' or .= 'inlineNA']">
              <xsl:call-template name="bracket">
                <xsl:with-param name="test" select="$pre"/>
                <xsl:with-param name="output" select="' ['"/>
              </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="bracket">
                <xsl:with-param name="test" select="$pre"/>
                <xsl:with-param name="output" select="' ('"/>
              </xsl:call-template>
            </xsl:otherwise>
          </xsl:choose>

          <!-- the reference -->
          <xsl:choose>
            <xsl:when test="name($pre)='a' and $pre/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and name($fol)='a' and $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and /ShowPage/xCiteMode[.='inlineNA']" />
            <xsl:when test="name($pref)='a' and $pref/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and name($fol)='a' and $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and /ShowPage/xCiteMode[.='inlineNA']" />
            <xsl:when test="name($pre)='a' and $pre/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and name($fol2)='a' and $fol2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and /ShowPage/xCiteMode[.='inlineNA']" />
            <xsl:when test="name($pre2)='a2' and $pre2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and name($fol2)='a' and $fol2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] and /ShowPage/xCiteMode[.='inlineNA']" />
            <xsl:otherwise>
              <!--
                         %<xsl:value-of select="name($pre2)"/>|<xsl:value-of select="name($pre)"/>|<xsl:value-of select="name($fol)"/>|<xsl:value-of select="name($fol2)"/>
                         -->
              <xsl:apply-templates select="." mode="Footnote"/>
            </xsl:otherwise>
          </xsl:choose>
          <!-- after  the references -->
          <xsl:choose>
            <xsl:when test="(name($fol)='a' or (string-length($fol)=1 and name($fol2)='a')) and 
                    ($fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] or $fol2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']) and /ShowPage/xCiteMode[.='inlineNA']" >
            </xsl:when>
            <xsl:when test="(name($fol)='a' or (string-length($fol)=1 and name($fol2)='a')) and 
                    ($fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] or $fol2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'])
                    and /ShowPage/xCiteMode[.='inlineLNI' or .= 'inlineN' or .='inlineNA' or .='inliney' or .='inlinea']">
              <xsl:text>, </xsl:text>
            </xsl:when>
            <xsl:when test="(name($fol)='a' or name($fol2)='a') and ($fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'] or $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus'])">
              <xsl:text>; </xsl:text>
            </xsl:when>
            <xsl:when test="/ShowPage/xCiteMode[.='inlineLNI' or .= 'inlineN' or .='inlineNA']">
              <xsl:call-template name="bracket">
                <xsl:with-param name="test" select="$fol"/>
                <xsl:with-param name="output" select="']'"/>
              </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="bracket">
                <xsl:with-param name="test" select="$fol"/>
                <xsl:with-param name="output" select="')'"/>
              </xsl:call-template>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>
        <xsl:when test="@class[.='Footnote' or .='CiteDir' or .='CiteInd' or .='CiteIndPlus'] or substring(@name,1,7)='_ftnref'">
          <xsl:choose>
            <xsl:when test="/ShowPage/Modus='export' and /ShowPage/xWordProc='OOff30'">
              <a class="sdfootnoteanc" name="sdfootnote1anc" href="#sdfootnote1sym">
                <sup>1</sup>
              </a>
              <xsl:if test="name($fol)='a' and $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">
                <sup>, </sup>
              </xsl:if>
            </xsl:when>
            <xsl:when test="/ShowPage/Modus='export'">
              <!-- <xsl:text disable-output-escaping="yes">&lt;sup&gt;</xsl:text>		-->
              <sup>
                <a style="mso-footnote-id:ftnx" href="#_ftnx" name="_ftnrefx">
                  <span class="MsoFootnoteReference">
                    <span style="mso-special-character:footnote"/>
                  </span>
                </a>
                <xsl:choose>
                  <xsl:when test="name($fol)='a' and $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">, </xsl:when>
                  <xsl:when test="string-length($fol)=1 and name($fol2)='a' and $fol2/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">, </xsl:when>
                </xsl:choose>
              </sup>
            </xsl:when>
            <xsl:otherwise>
              <sup>
                <xsl:apply-templates select="." mode="Footnote"/>
                <xsl:if test="name($fol)='a' and $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">, </xsl:if>
              </sup>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>
        <xsl:when test="starts-with(@href,'#')">
          <a>
            <xsl:apply-templates select="node()|@*" mode="copy"/>
          </a>
        </xsl:when>
        <xsl:when test="@class[.='AutoNumFig' or .='AutoNumTab' or .='AutoNumFml']">
          <!-- 18.02.2023 -->
          <xsl:variable name="href" select="@href" />
          <xsl:variable name="class" select="@class" />
          <xsl:text disable-output-escaping="yes">&lt;!--[if supportFields]>
          &lt;span style='mso-element: field-begin'>&lt;/span>&lt;span style='mso-spacerun:yes'> &lt;/span></xsl:text>
          <xsl:choose>
            <xsl:when test="@class='AutoNumFig'">SEQ Abbildung \* ARABIC </xsl:when>
            <xsl:when test="@class='AutoNumTab'">SEQ Tabelle \* ARABIC </xsl:when>
            <xsl:when test="@class='AutoNumFml'">SEQ Formel \* ARABIC </xsl:when>
          </xsl:choose>
          <xsl:text disable-output-escaping="yes">&lt;span style='mso-element:field-separator'>&lt;/span>
          &lt;![endif]--></xsl:text>
          <span style="mso-no-proof:yes">
            <xsl:for-each select="//a[@class=$class]">
              <xsl:if test="@href=$href">
                <xsl:value-of select="position()"/>
              </xsl:if>
            </xsl:for-each>
          </span>
          <xsl:text disable-output-escaping="yes">&lt;!--[if supportFields]>&lt;span style='mso-element:field-end'>&lt;/span>&lt;![endif]--></xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <a href="{@href}" target="_blank">
            <xsl:attribute name="title">
              <xsl:choose>
                <xsl:when test="//Subobj[@id=$id or @link=$id]/sTemplate='NextBib.xsl'">
                  <xsl:apply-templates select="//Subobj[@id=$id or @link=$id]" mode="biblio_t"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="//Subobj[@id=$id or @link=$id]/mRichtext|//Subobj[@id=$id or @link=$id]/Richtext"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:attribute>
            <xsl:choose>
              <xsl:when test="@class='AutoNumFigTitle'">
                <xsl:apply-templates select="." mode="AutoNumFigTitle"/>
              </xsl:when>
              <xsl:when test="@class='AutoNumFig'">
                <xsl:apply-templates select="." mode="AutoNumFig"/>
              </xsl:when>
              <xsl:when test="@class='AutoNumTab'">
                <xsl:apply-templates select="." mode="AutoNumTab"/>
              </xsl:when>
              <xsl:when test="@class='AutoNumFml'">
                <xsl:apply-templates select="." mode="AutoNumFml"/>
              </xsl:when>
              <xsl:when test="@class='Number' and @href=//a[@class='AutoNumFigTitle' or @class='AutoNumFig']/@href">
                <xsl:variable name="href" select="@href"/>
                <xsl:apply-templates select="//a[(@class='AutoNumFigTitle' or @class='AutoNumFig') and @href=$href]" mode="NumFig"/>
              </xsl:when>
              <xsl:when test="@class='Number' and @href=//a[@class='AutoNumTab']/@href">
                <xsl:variable name="href" select="@href"/>
                <xsl:apply-templates select="//a[@class='AutoNumTab' and @href=$href]" mode="NumTab"/>
              </xsl:when>
              <xsl:when test="@class='Number' and @href=//a[@class='AutoNumFml']/@href">
                <xsl:variable name="href" select="@href"/>
                <xsl:apply-templates select="//a[@class='AutoNumFml' and @href=$href]" mode="NumFml"/>
              </xsl:when>
              <xsl:when test="@class='Number' and //Subobj/@id=$id">
                <xsl:value-of select="//Subobj[@id=$id]/Number"/>
              </xsl:when>
              <xsl:when test="/ShowPage/xSectionNumber='none' and @class = 'Section'">
                <xsl:text>»</xsl:text>
                <xsl:value-of select="@title" />
                <xsl:text>«</xsl:text>
              </xsl:when>
              <xsl:when test="@class='Number'">
                <xsl:text>[██████]</xsl:text>
              </xsl:when>
              <xsl:when test="@class[.= 'Title' or .= 'Section' or .='NumberTitle' or .='SectionTitle']">
                <xsl:apply-templates select="//Subobj" mode="CrossRef">
                  <xsl:with-param name="mode">
                    <xsl:value-of select="@class"/>
                  </xsl:with-param>
                  <xsl:with-param name="id">
                    <xsl:value-of select="substring-before(substring-after(concat(@href,'&amp;'),'f='),'&amp;')"/>
                  </xsl:with-param>
                </xsl:apply-templates>
              </xsl:when>
              <xsl:when test="@class='Comment'">
                <xsl:attribute name="style">background-color: yellow;</xsl:attribute>
                <xsl:apply-templates select="@title|@class" mode="copy"/>
                <xsl:apply-templates/>
                <span class="Nodisplay">
                  <xsl:value-of select="@title"/>
                </span>
              </xsl:when>
              <xsl:when test="@class='Strike'">
                <!--
                                <xsl:attribute name="style">text-decoration: line-through; color: red; border-left: solid 1px red; border-right: solid 1px red;</xsl:attribute>
                                -->
                <xsl:apply-templates select="@title|@class" mode="copy"/>
                <xsl:apply-templates/>
                <span class="Nodisplay">
                  <xsl:value-of select="@title"/>
                </span>
              </xsl:when>
              <xsl:otherwise>
                <xsl:apply-templates select="node() | @title | @href | @target " mode="copy"/>
              </xsl:otherwise>
            </xsl:choose>
          </a>
        </xsl:otherwise>
      </xsl:choose>
    </span>
  </xsl:template>
  <xsl:template match="a" mode="Footnote">
    <xsl:param name="fmt" select="''"/>
    <xsl:variable name="sid" select="substring-before(substring-after(concat(@href,'&amp;'),'?f='),'&amp;')"/>

    <xsl:variable name="id">
      <xsl:choose>

        <xsl:when test="//Subobj[@link=$sid]/sTemplate='NextBib.xsl'">
          <xsl:value-of select="$sid"/>
        </xsl:when>
        <xsl:when test="//Subobj[@id=$sid]/sTemplate='NextBib.xsl'">
          <xsl:value-of select="$sid"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="//Subobj[@id=$sid]/../@id"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!--
        -->
    <a href="?f={$id}" target="_blank">
      <xsl:if test="$fmt != ''">
        <xsl:attribute name="class">
          <xsl:value-of select="$fmt"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:if test="//Subobj[@id=$id or @link=$id]/sTemplate='NextBib.xsl'">
        <xsl:attribute name="title">
          <xsl:apply-templates select="//Subobj[@id=$id or @link=$id]" mode="biblio_t"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:variable name="pres" select="preceding-sibling::node()"/>
      <xsl:variable name="pre" select="$pres[last()]"/>
      <xsl:variable name="pref" select="$pres[1]"/>
      <xsl:choose>
        <xsl:when test="starts-with(/ShowPage/xCiteMode,'inline') and name($pre)='a' and $pre/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']"/>
        <xsl:when test="starts-with(/ShowPage/xCiteMode,'inline') and name($pref)='a' and $pref/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']"/>
        <xsl:when test="@class='CiteInd' and /ShowPage/xCitePrefix!='' and not(starts-with(/ShowPage/xCiteMode,'inline'))">
          <xsl:value-of select="substring-before(/ShowPage/xCitePrefix,'|')"/>
        </xsl:when>
        <xsl:when test="@class='CiteInd' and /ShowPage/xCitePrefix!=''">
          <xsl:value-of select="substring-before(substring-after(substring-after(/ShowPage/xCitePrefix,'|'),'|'),'|')"/>
        </xsl:when>
        <xsl:when test="@class='CiteIndPlus' and /ShowPage/xCitePrefix!='' and not(starts-with(/ShowPage/xCiteMode,'inline'))">
          <xsl:value-of select="substring-before(substring-after(/ShowPage/xCitePrefix,'|'),'|')"/>
        </xsl:when>
        <xsl:when test="@class='CiteIndPlus' and /ShowPage/xCitePrefix!=''">
          <xsl:value-of select="substring-after(substring-after(substring-after(/ShowPage/xCitePrefix,'|'),'|'),'|')"/>
        </xsl:when>
        <xsl:when test="@class='CiteInd' and not(starts-with(/ShowPage/xCiteMode,'inline'))">
          <xsl:value-of select="$lsCiteInd"/>
        </xsl:when>
        <xsl:when test="@class='CiteInd'">
          <xsl:value-of select="translate($lsCiteInd,'VS','vs')"/>
        </xsl:when>
        <xsl:when test="@class='CiteIndPlus' and not(starts-with(/ShowPage/xCiteMode,'inline'))">
          <xsl:value-of select="$lsCiteIndPlus"/>
        </xsl:when>
        <xsl:when test="@class='CiteIndPlus'">
          <xsl:value-of select="translate($lsCiteIndPlus,'VS','vs')"/>
        </xsl:when>
      </xsl:choose>
      <xsl:choose>
        <xsl:when test="@class='Footnote' or starts-with(@name,'_ftn')">
          <xsl:apply-templates/>
        </xsl:when>
        <xsl:when test="$id=''">
          <span sytle="background-color: yellow">[###]</span>
        </xsl:when>
        <xsl:when test="count(//tr[@class='reference' and @id=$id])=1">
          <xsl:value-of select="normalize-space(//tr[@class='reference' and @id=$id]/td[1])"/>
        </xsl:when>
        <xsl:when test="/ShowPage/xCiteMode[.='short' or .='inline']">
          <xsl:value-of select="//Subobj[@id=$id or @link=$id]/sTitle"/>
        </xsl:when>
        <xsl:when test="/ShowPage/xCiteMode[.='shorty' or .='inliney' or .='inlinea' or .= 'inlineLNI']">
          <xsl:value-of select="substring-before(//Subobj[@id=$id or @link=$id]/sTitle,'[')"/>
          <xsl:value-of select="//Subobj[@id=$id or @link=$id]//xYear"/>
          <xsl:apply-templates select="//Subobj[@id=$id or @link=$id]" mode="abc"/>
        </xsl:when>
        <xsl:when test="/ShowPage/xCiteMode='long'">
          <xsl:if test="string-length(//Subobj[@id=$id or @link=$id]//xAuthor)">
            <xsl:value-of select="//Subobj[@id=$id or @link=$id]//xAuthor"/>:
          </xsl:if>
          <xsl:value-of select="//Subobj[@id=$id or @link=$id]//xTitle"/>
        </xsl:when>
        <xsl:when test="/ShowPage/xCiteMode='inlineN'">
          <xsl:apply-templates select="/ShowPage" mode="CiteNumber">
            <xsl:with-param name="sid" select="$sid"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:when test="/ShowPage/xCiteMode='inlineNA'">
          <xsl:value-of select="1 + count(preceding::a[starts-with(@class,'Cite')])"/>
        </xsl:when>
      </xsl:choose>
      <xsl:if test="@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">
        <xsl:choose>
          <xsl:when test="string-length(.) &lt; 2"/>
          <xsl:when test="/ShowPage/xCiteMode='inlineNA'"/>
          <xsl:when test="contains(.,'[') and contains(.,']')">
            <xsl:value-of select="substring-after(.,']')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>, </xsl:text>
            <xsl:apply-templates/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
    </a>
    <!--
        -->
  </xsl:template>
  <xsl:template match="img">
    <xsl:param name="style">
      <xsl:text>;</xsl:text>
      <xsl:value-of select="translate(@style,' ','')"/>
      <xsl:text>;</xsl:text>
    </xsl:param>
    <xsl:param name="width">
      <xsl:choose>
        <xsl:when test="count(@width)">
          <xsl:value-of select="@width"/>
        </xsl:when>
        <xsl:when test="contains($style,';width:')">
          <xsl:value-of select="substring-before(substring-after($style,';width:'),'p')"/>
        </xsl:when>
      </xsl:choose>
    </xsl:param>
    <xsl:param name="height">
      <xsl:choose>
        <xsl:when test="count(@height)">
          <xsl:value-of select="@height"/>
        </xsl:when>
        <xsl:when test="contains($style,';height:')">
          <xsl:value-of select="substring-before(substring-after($style,';height:'),'p')"/>
        </xsl:when>
      </xsl:choose>
    </xsl:param>
    <xsl:choose>
      <xsl:when test="/ShowPage/Modus='export' and translate(@align,'M','m')='absmiddle'">
        <span>
          <xsl:attribute name="style">
            <xsl:text>vertical-align:-</xsl:text>
            <xsl:choose>
              <xsl:when test="$height > 0">
                <xsl:value-of select="ceiling(($height - 12) div 2.3)"/>
              </xsl:when>
              <xsl:when test="contains(@alt,'_')">
                <xsl:text>2</xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text>1</xsl:text>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:text>pt;</xsl:text>
          </xsl:attribute>
          <xsl:apply-templates select="." mode="doit">
            <xsl:with-param name="width" select="$width"/>
            <xsl:with-param name="height" select="$height"/>
          </xsl:apply-templates>
        </span>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="doit">
          <xsl:with-param name="width" select="$width"/>
          <xsl:with-param name="height" select="$height"/>
        </xsl:apply-templates>

      </xsl:otherwise>
    </xsl:choose>

  </xsl:template>
  <xsl:template match="img" mode="doit">
    <xsl:param name="height"/>
    <xsl:param name="width"/>
    <img>
      <xsl:if test="count(@height)=0 and $height > 0">
        <xsl:attribute name="height">
          <xsl:value-of select="$height"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:if test="count(@width)=0 and $width > 0">
        <xsl:attribute name="width">
          <xsl:value-of select="$width"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:apply-templates select="@class" mode="copy" />
      <xsl:choose>
        <xsl:when test="/ShowPage/Modus='all'">
          <xsl:attribute name="src">
            <xsl:apply-templates select="." mode="path"/>
            <xsl:choose>
              <xsl:when test="not(contains(@src,'?f='))">
                <xsl:value-of select="@src"/>
              </xsl:when>
              <xsl:when test="$width > $height">
                <xsl:value-of select="@src"/>
                <xsl:text>&amp;ex=</xsl:text>
                <xsl:value-of select="$width"/>
              </xsl:when>
              <xsl:when test="$height > 0">
                <xsl:value-of select="@src"/>
                <xsl:text>&amp;ex=</xsl:text>
                <xsl:value-of select="$height"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@src"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="contains(@src,'f=pub/')">
          <xsl:attribute name="src">
            <xsl:apply-templates select="." mode="path"/>
            <xsl:value-of select="substring-before(concat(substring-after(@src,'f='),'&amp;'),'&amp;')"/>
          </xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="src">
            <xsl:apply-templates select="." mode="path"/>
            <xsl:value-of select="@src"/>
            <xsl:if test="contains(@src,'?f=')">
              <xsl:text>&amp;INFO=</xsl:text>
              <xsl:value-of select="/ShowPage/INFO"/>
            </xsl:if>
          </xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@align |@title | @height | @width | @border | @style" mode="copy"/>
      <xsl:attribute name="alt">Figure</xsl:attribute>
    </img>

  </xsl:template>
  <xsl:template match="ColX1|ColX2"/>
  <!-- ################### formating #######################################  -->
  <xsl:template match="td">
    <td>
      <xsl:apply-templates select="@*" mode="copy"/>
      <xsl:choose>
        <xsl:when test="count(p) = 0">
          <p class="td">
            <xsl:apply-templates />
          </p>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates />
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>
  <xsl:template match="p">
    <xsl:choose>
      <xsl:when test=". = '&#160;'">
        <p>
          <xsl:value-of select="."/>
        </p>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="standard"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="table[@class='xcp_meta1']">
    <xsl:for-each select="tbody/tr/td[1]">
      <xsl:choose>
        <xsl:when test="count(p)">
          <xsl:apply-templates/>
        </xsl:when>
        <!--
                <xsl:when test="count(a)=0 and ancestor::Richtext/../sTemplate = 'NoTitle.xsl' and /ShowPage[Modus='all' and count(Edit)]">
                    <p class="standard">
                        <a href="javascript:EditPage('{ancestor::Richtext/../@id}')">
                            <xsl:apply-templates/>
                        </a>
                    </p>
                </xsl:when>
                -->
        <xsl:otherwise>
          <xsl:apply-templates select="." mode="standard"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="div">
    <xsl:choose>
      <xsl:when test="div/@id='ftn1'"/>
      <xsl:when test="@class='authoronly'"/>
      <xsl:when test="name(..)='li'">
        <p class="enum">
          <xsl:apply-templates/>
        </p>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="standard"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="p|div | td " mode="standard">
    <xsl:param name="showedit" select="0"/>
    <p>
      <xsl:if test="count(@align)">
        <xsl:attribute name="align">
          <xsl:value-of select="@align"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="/ShowPage/param='strict'"/>
        <xsl:when test="count(@style)">
          <xsl:attribute name="style">
            <xsl:value-of select="@style"/>
          </xsl:attribute>
        </xsl:when>
      </xsl:choose>
      <xsl:attribute name="class">
        <xsl:variable name="v">
          <xsl:value-of select="normalize-space(.)"/>
        </xsl:variable>
        <xsl:choose>
          <xsl:when test="count(.//a[@class='AutoNumFig'])=1">img</xsl:when>
          <xsl:when test="count(.//a[@class='AutoNumTab'])=1">tab</xsl:when>
          <xsl:when test="count(.//a[@class='AutoNumFml'])=1">fml</xsl:when>
          <xsl:when test="(translate($v,' &#160;','')='' and count(.//img)=1)">img-1</xsl:when>
          <xsl:when test="starts-with(@class,'mso') or /ShowPage/param='strict' or count(@class)=0">
            <xsl:choose>
              <xsl:when test="../../../../@class='xcp_meta1'">standard</xsl:when>
              <xsl:when test="name(..)='td'">td</xsl:when>
              <xsl:otherwise>standard</xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="@class"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:attribute>
      <xsl:apply-templates/>
      <xsl:if test="/ShowPage[Modus='all' and count(Edit)]">
        <img src="{/ShowPage/ImgDir}edit.gif" class="HoverEdit" title="{$lsEdit}"
            onclick="EditPage('{ancestor::Richtext/../@id}');"/>
      </xsl:if>
    </p>
  </xsl:template>
  <xsl:template match="li">
    <li>
      <xsl:choose>
        <xsl:when test="/ShowPage/Modus='export' and (count(div)=0 or /ShowPage/param='strict')">
          <p class="enum">
            <xsl:apply-templates/>
          </p>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates/>
        </xsl:otherwise>
      </xsl:choose>
    </li>
  </xsl:template>
  <xsl:template match="span|font">
    <xsl:choose>
      <xsl:when test="/ShowPage/param='strict' and count(ancestor::table[@name='coverpage'])=0">
        <xsl:apply-templates/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:element name="{name()}">
          <xsl:apply-templates select="@*" mode="copy"/>
          <xsl:apply-templates/>
        </xsl:element>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="strong">
    <xsl:choose>
      <xsl:when test="name(..)='mRichtext'">
        <p class="standard">
          <b>
            <xsl:apply-templates/>
          </b>
        </p>
      </xsl:when>
      <xsl:otherwise>
        <b>
          <xsl:apply-templates/>
        </b>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="br">
    <xsl:choose>
      <xsl:when test="@style='PAGE-BREAK-AFTER: always' and /ShowPage/xWordProc='OOff30'">
        <p STYLE="margin-bottom: 0cm; page-break-after: always">
          <br/>
        </p>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="copy"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="div[@style='PAGE-BREAK-AFTER: always' or @style='page-break-after: always']">
    <br style="PAGE-BREAK-AFTER: always"/>
  </xsl:template>
  <!-- ################# für die Body-Definition ############################# -->
  <xsl:template match="@super">
    <tr>
      <td/>
      <td colspan="3">
        <font size="2">
          <xsl:apply-templates select="../Zusatz"/>
        </font>
      </td>
    </tr>
    <tr>
      <td valign="bottom" align="left" width="23" style="vertical-align: bottom;">
        <a>
          <xsl:attribute name="target">
            <xsl:value-of select="../Target"/>
          </xsl:attribute>
          <xsl:attribute name="href">
            <xsl:value-of select="//ShowPage/Script"/>
            <xsl:text>?f=</xsl:text>
            <xsl:value-of select="."/>
          </xsl:attribute>
          <img border="0">
            <xsl:attribute name="src">
              <xsl:value-of select="../ImgDir"/>
              <xsl:text>up.gif</xsl:text>
            </xsl:attribute>
          </img>
        </a>
      </td>
      <td colspan="3">
        <br/>
        <font size="2">
          <i>
            <xsl:choose>
              <xsl:when test="../@name[.='index']">
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="//ShowPage/Script"/>
                    <xsl:text>?f=neues</xsl:text>
                  </xsl:attribute>
                  <xsl:attribute name="target">
                    <xsl:value-of select="../Target"/>
                  </xsl:attribute>
                  <u>New</u>
                </a>
                <xsl:text> </xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="//ShowPage/Script"/>
                    <xsl:text>?f=index</xsl:text>
                  </xsl:attribute>
                  <xsl:attribute name="target">
                    <xsl:value-of select="../Target"/>
                  </xsl:attribute>
                  <u>Home</u>
                </a>
                <xsl:text> </xsl:text>
              </xsl:otherwise>
            </xsl:choose>
            <a>
              <xsl:attribute name="target">
                <xsl:value-of select="../Target"/>
              </xsl:attribute>
              <xsl:attribute name="href">
                <xsl:value-of select="//ShowPage/Script"/>
                <xsl:text>?f=indexmap&amp;ex=</xsl:text>
                <xsl:value-of select="../@id"/>
              </xsl:attribute>
              <u>Site map</u>
            </a>
            <xsl:text> </xsl:text>
            <a>
              <xsl:attribute name="href">
                <xsl:value-of select="//ShowPage/Script"/>
                <xsl:text>?f=search</xsl:text>
              </xsl:attribute>
              <xsl:attribute name="target">
                <xsl:value-of select="../Target"/>
              </xsl:attribute>
              <u>Search</u>
            </a>
            <xsl:text> </xsl:text>
            <a>
              <xsl:attribute name="target">
                <xsl:value-of select="../Target"/>
              </xsl:attribute>
              <xsl:attribute name="href">
                <xsl:value-of select="../Edit/@link"/>
              </xsl:attribute>
              <u>
                <xsl:choose>
                  <xsl:when test="contains(../Edit/@link,'m=edit')">Edit</xsl:when>
                  <xsl:when test="contains(../Edit/@link,'m=append')">Append</xsl:when>
                </xsl:choose>
              </u>
            </a>
          </i>
        </font>
      </td>
    </tr>
  </xsl:template>
  <xsl:template match="ShowPage">
    <xsl:attribute name="bgcolor">
      <xsl:choose>
        <xsl:when test="bgcolor[.!='']">
          <xsl:value-of select="bgcolor"/>
        </xsl:when>
        <xsl:otherwise>#f8f8f0</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="text">
      <xsl:choose>
        <xsl:when test="text[.!='']">
          <xsl:value-of select="text"/>
        </xsl:when>
        <xsl:otherwise>#000000</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="link">
      <xsl:choose>
        <xsl:when test="link[.!='']">
          <xsl:value-of select="ShowPage/link"/>
        </xsl:when>
        <xsl:when test="text[.!='']">
          <xsl:value-of select="text"/>
        </xsl:when>
        <xsl:otherwise>#000000</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="vlink">
      <xsl:choose>
        <xsl:when test="vlink[.!='']">
          <xsl:value-of select="vlink"/>
        </xsl:when>
        <xsl:when test="text[.!='']">
          <xsl:value-of select="text"/>
        </xsl:when>
        <xsl:otherwise>#000000</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="alink">
      <xsl:choose>
        <xsl:when test="alink[.!='']">
          <xsl:value-of select="alink"/>
        </xsl:when>
        <xsl:when test="text[.!='']">
          <xsl:value-of select="text"/>
        </xsl:when>
        <xsl:otherwise>#FF0000</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:if test="Graphik[.!='']">
      <xsl:choose>
        <xsl:when test="IE40[.='True']">
          <img>
            <xsl:attribute name="src">
              <xsl:value-of select="ImgDir"/>
              <xsl:apply-templates select="sImage"/>
            </xsl:attribute>
          </img>
        </xsl:when>
        <xsl:when test="Mozilla[.>='4.0']"/>
        <xsl:otherwise>
          <xsl:attribute name="background">
            <xsl:value-of select="Graphik"/>
          </xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
    <a name="anfang"/>
  </xsl:template>
  <xsl:template match="Body">
    <xsl:choose>
      <xsl:when test="count(XMLtext)=0 and count(Xtext)=0">
        <xsl:apply-templates/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="XMLtext|Xtext"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="sTitle">
    <tr>
      <td valign="TOP"/>
      <td width="430" colspan="4">
        <p/>
        <font size="3">
          <b>
            <xsl:choose>
              <xsl:when test="../Volltitel[.!='']">
                <xsl:value-of select="../Volltitel"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="../sTitle"/>
              </xsl:otherwise>
            </xsl:choose>
          </b>
        </font>
        <xsl:if test="../Status[.='Deadline' or .='Appointment' or .='Todo']">
          <br/>
          <br/>
          <table bgcolor="0" cellspacing="1" border="0">
            <tr>
              <td bgcolor="0">
                <font size="2" color="#ffffff">
                  <b>
                    <xsl:value-of select="../Status"/>
                  </b>
                </font>
              </td>
              <xsl:if test="../Status[.!='Todo']">
                <td bgcolor="#ffffff">
                  <font size="2">
                    <xsl:value-of select="../Termin"/>
                  </font>
                </td>
              </xsl:if>
              <td bgcolor="#c0c0c0">
                <font size="2">
                  <xsl:text>Priority: </xsl:text>
                  <xsl:value-of select="../Wichtig"/>
                </font>
              </td>
            </tr>
          </table>
        </xsl:if>
        <xsl:choose>
          <xsl:when test="../Volltitel = ' '"/>
          <xsl:otherwise>
            <br/>
            <br/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="../Richtext!=''">
          <xsl:apply-templates select="../Richtext"/>
        </xsl:if>
        <xsl:if test="../XMLtext !='' or ../Xtext !=''">
          <xsl:apply-templates select="../XMLtext|../Xtext"/>
        </xsl:if>
        <xsl:if test="../pre[.!='']">
          <pre>
            <xsl:value-of select="../pre"/>
          </pre>
          <br/>
        </xsl:if>
        <xsl:if test="../author[.!='']">
          <br/>
          <table name="book">
            <xsl:for-each select="../author">
              <tr>
                <td bgcolor="c0c0c0">
                  <font size="1">
                    <b>Author</b>
                  </font>
                </td>
                <td bgcolor="f8f8c0">
                  <font size="2">
                    <xsl:value-of select="."/>
                  </font>
                </td>
              </tr>
            </xsl:for-each>
            <xsl:for-each select="../signature">
              <tr>
                <td bgcolor="c0c0c0">
                  <font size="1">
                    <b>Signature</b>
                  </font>
                </td>
                <td bgcolor="f8f8c0">
                  <font size="2">
                    <xsl:value-of select="."/>
                  </font>
                </td>
              </tr>
            </xsl:for-each>
            <tr>
              <td bgcolor="c0c0c0">
                <font size="1">
                  <b>Publisher</b>
                </font>
              </td>
              <td bgcolor="f8f8c0">
                <font size="2">
                  <xsl:value-of select="../publisher"/>
                </font>
              </td>
            </tr>
            <tr>
              <td bgcolor="c0c0c0">
                <font size="1">
                  <b>ISBN</b>
                </font>
              </td>
              <td bgcolor="f8f8c0">
                <font size="2">
                  <xsl:value-of select="../isbn"/>
                </font>
              </td>
            </tr>
          </table>
        </xsl:if>
      </td>
    </tr>
  </xsl:template>
  <!-- ############### Space, protected Space ################-->
  <xsl:template match="text()">
    <xsl:variable name="fol" select="following-sibling::node()[1]"/>
    <xsl:variable name="pre" select="preceding-sibling::node()[1]"/>
    <xsl:variable name="len" select="string-length(.)" />
    <xsl:choose>
      <xsl:when test="$len=1">
        <xsl:value-of select="."/>
      </xsl:when>
      <xsl:when test="contains(.,'&#160;&#160;') or starts-with(.,'&#160; ')">
        <xsl:value-of select="."/>
      </xsl:when>
      <xsl:when test="(starts-with(.,' ') or starts-with(.,'&#160;')) and name($pre)='img'">
        <xsl:text> </xsl:text>
        <span style="display:none;font-size:1px;">&#160;</span>
        <xsl:value-of select="."/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="translate(.,'&#160;',' ')"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="text()" mode="old">
    <xsl:variable name="fol" select="following-sibling::node()[1]"/>
    <xsl:variable name="len" select="string-length(.)" />
    <xsl:choose>
      <xsl:when test="(substring(.,$len,1)=' ' or substring(.,$len,1)='&#160;') and name($fol)='a' and $fol/@class[.='CiteDir' or .='CiteInd' or .='CiteIndPlus']">
        <xsl:value-of select="substring(.,1, $len - 1)"/>
      </xsl:when>
      <xsl:when test=".=' ' or .='&#160;'" />
      <!---  no space between two cites -->
      <xsl:when test="contains(.,'&#160;&#160;')">
        <xsl:value-of select="."/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="concat(translate(substring(.,1,1),' ','&#160;'),translate(substring(.,2),'&#160;',' '))"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--  ########################### Aufgabe ###############################  -->
  <xsl:template match="Subobj[count(//table[@class='Aufgabe'])&gt;0]" mode="all">
    <xsl:choose>
      <xsl:when test="count(Richtext//table[@class='Aufgabe'])">
        <p class="standard">
          <xsl:if test="count(Body/pagebreak)">
            <xsl:attribute name="style">page-break-before:always;</xsl:attribute>
          </xsl:if>
          <xsl:choose>
            <xsl:when test="ShowPage/Modus='export'">
              <xsl:value-of select="Section"/>
            </xsl:when>
            <xsl:otherwise>
              <a href="javascript:EditPage('{@id}');">
                <xsl:value-of select="Section"/>
              </a>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text> </xsl:text>
          <xsl:apply-templates select="Richtext//table[@class='Aufgabe']/tbody/tr[2]/td[2]/node()"/>
          <xsl:if test="Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2]/node() &gt; 0">
            <xsl:text> (</xsl:text>
            <xsl:apply-templates select="Richtext//table[@class='Aufgabe']/tbody/tr[1]/td[2]/node()"/>
            <xsl:text>&#160;P)</xsl:text>
          </xsl:if>
        </p>
        <xsl:apply-templates select="Richtext//table[@class='Aufgabe']" mode="Aufgabe"/>
      </xsl:when>
      <xsl:otherwise>
        <h3 id="sec{@id}">
          <xsl:if test="position() &gt; 1 and count(Body/nopagebreak) = 0">
            <xsl:attribute name="style">page-break-before:always;</xsl:attribute>
          </xsl:if>
          <xsl:variable name="result">
            <xsl:value-of select="sum(Subobj//table[@class='Aufgabe']/tbody/tr[1]/td[2])"/>
          </xsl:variable>
          <xsl:choose>
            <xsl:when test="ShowPage/Modus='export'">
              <xsl:value-of select="Section"/>
              <xsl:text> </xsl:text>
              <xsl:value-of select="sTitle"/>
              <xsl:if test="$result != 'NaN'">
                <xsl:text> (</xsl:text>
                <xsl:value-of select="$result"/>
                <xsl:text> P)</xsl:text>
              </xsl:if>
            </xsl:when>
            <xsl:otherwise>
              <a href="javascript:EditPage('{@id}');">
                <xsl:value-of select="Section"/>
                <xsl:text> </xsl:text>
                <xsl:value-of select="sTitle"/>
                <xsl:if test="$result != 'NaN'">
                  <xsl:text> (</xsl:text>
                  <xsl:value-of select="$result"/>
                  <xsl:text> P)</xsl:text>
                </xsl:if>
              </a>
            </xsl:otherwise>
          </xsl:choose>
        </h3>
        <xsl:apply-templates select="Richtext"/>
        <xsl:apply-templates select="Subobj" mode="all"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="table" mode="Aufgabe">
    <table class="SimpleT" width="100%" cellpadding="2">
      <tbody>
        <xsl:apply-templates select="tbody/tr[position()&gt;2]" mode="Aufgabe"/>
      </tbody>
    </table>
  </xsl:template>
  <xsl:template match="tr" mode="Aufgabe">
    <xsl:if test="translate(td[1],'&#160;','')=''">
      <tr>
        <xsl:apply-templates select="td[position() &gt; 1]" mode="Aufgabe"/>
      </tr>
    </xsl:if>
  </xsl:template>
  <xsl:template match="td" mode="Aufgabe">
    <td valign="top">
      <xsl:attribute name="style">
        <xsl:apply-templates select="." mode="style">
          <xsl:with-param name="token" select="'height'"/>
          <xsl:with-param name="default">
            <xsl:choose>
              <xsl:when test="count(@height)">
                <xsl:value-of select="@height"/>
              </xsl:when>
              <xsl:otherwise>40</xsl:otherwise>
            </xsl:choose>
            <xsl:text>px;</xsl:text>
          </xsl:with-param>
        </xsl:apply-templates>
        <xsl:apply-templates select="." mode="style">
          <xsl:with-param name="token" select="'background'"/>
        </xsl:apply-templates >
        <xsl:apply-templates select="." mode="style">
          <xsl:with-param name="token" select="'width'"/>
        </xsl:apply-templates >
      </xsl:attribute>
      <xsl:apply-templates select="@rowspan|@colspan|@align|@width|@bgcolor" mode="copy"/>
      <xsl:apply-templates/>
    </td>
  </xsl:template>
  <xsl:template match="td" mode="style">
    <xsl:param name="token" select="''"/>
    <xsl:param name="default" select="''"/>
    <xsl:choose>
      <xsl:when test="$token=''" />
      <xsl:when test="contains(@style,$token)">
        <xsl:value-of select="$token"/>
        <xsl:value-of select="substring-before(concat(substring-after(@style,$token),';'),';')"/>
        <xsl:text>;</xsl:text>
      </xsl:when>
      <xsl:when test="$default != ''">
        <xsl:value-of select="$token"/>
        <xsl:text>:</xsl:text>
        <xsl:value-of select="$default"/>
        <xsl:text>;</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- ############################# Biblio ##################################  -->
  <xsl:template match="ShowPage|Subobj" mode="ReferenceText">
    <xsl:choose>
      <xsl:when test="/ShowPage/ex='references'"/>
      <xsl:when test="/ShowPage/Modus='all'">
        <a href="?f={@id}" target="_blank">
          <h1 id="sec{@id}">
            <xsl:value-of select="sTitle"/>
          </h1>
        </a>
      </xsl:when>
      <xsl:otherwise>
        <h1 id="sec{@id}">
          <xsl:value-of select="sTitle"/>
        </h1>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:variable name="showall" select="Body/ListOption/@showall"/>
    <xsl:choose>
      <xsl:when test="/ShowPage/ex='references'">
        <table class="References" border="1">
          <xsl:for-each select="descendant-or-self::Subobj[sTemplate='NextBib.xsl' and not(Body/xListNode!='') and (
                            (concat('?f=',@id) = //a/@href) or 
                            (concat('?f=',@link) = //a/@href) or 
                            $showall = 1 or
                            count(Subobj[concat('?f=',@id) = //a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']]/@href]) or
                            (count(//a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']])=0)
                        )]">
            <xsl:sort select="substring-before(sTitle,'[')"/>
            <xsl:sort select=".//xYear"/>
            <xsl:sort select="@id" data-type="number"/>
            <xsl:variable name="link" select="@link"/>
            <xsl:variable name="id" select="@id"/>
            <xsl:choose>
              <xsl:when test="@link = //Subobj/@id"/>
              <xsl:when test="count(//Subobj[@id > $id and @link = $link])"/>
              <xsl:when test="ancestor::Subobj/preceding::Subobj/descendant-or-self::Subobj/@id = $id"/>
              <xsl:otherwise>
                <tr valign="top" id="{@id}" class="reference">
                  <td valgin="top" nowrap="nowrap">
                    <a href="?f={@id}" target="_blank">
                      <xsl:apply-templates select="." mode="firstyear"/>
                    </a>
                  </td>
                  <td valgin="top" width="90%">
                    <xsl:apply-templates select="." mode="biblio_doc"/>
                  </td>
                </tr>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:when test="/ShowPage/xCiteMode='inlineN'">
        <xsl:for-each select="descendant-or-self::Subobj[sTemplate='NextBib.xsl' and not(Body/xListNode!='') and (
                            (concat('?f=',@id) = //a/@href) or 
                            (concat('?f=',@link) = //a/@href) or 
                            $showall = 1 or
                          count(Subobj[concat('?f=',@id) = //a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']]/@href]) or
                            (count(//a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']])=0)
                        )]">
          <xsl:sort select="sTitle"/>
          <xsl:variable name="link" select="@link"/>
          <xsl:variable name="id" select="@id"/>
          <xsl:choose>
            <xsl:when test="@link = //Subobj/@id"/>
            <xsl:when test="count(//Subobj[@id > $id and @link = $link])"/>
            <xsl:when test="ancestor::Subobj/preceding::Subobj/descendant-or-self::Subobj/@id = $id"/>
            <xsl:otherwise>
              <!--              <table align="right" style="width: 570px;" border="0" cellspacing="0" cellpadding="0">
                <tbody>
                  <tr>
                    <td style="width: 570px;">
                      <p class="reference" id="{@id}">
                        <xsl:apply-templates select="." mode="RefText" />
                      </p>
                    </td>
                  </tr>
                </tbody>
              </table>
              <table style="width: 30px;" border="0" cellspacing="0" cellpadding="0">
                <tbody>
                  <tr>
                    <td style="width: 30px;">
                      <p class="reference">
                        <xsl:text>[</xsl:text>
                        <xsl:value-of select="position()"/>
                        <xsl:text>] </xsl:text>
                      </p>
                    </td>
                  </tr>

                </tbody>
              </table>
              <p style="line-heigt: 1px;" />
              -->
              <table border="0" cellspacing="0" cellpadding="0">
                <tbody>
                  <tr>
                    <td style="width: 30px;">
                      <p class="reference">
                        <xsl:text>[</xsl:text>
                        <xsl:value-of select="position()"/>
                        <xsl:text>] </xsl:text>
                      </p>
                    </td>
                    <td style="width: 570px;">
                      <p class="reference" id="{@id}">
                        <xsl:apply-templates select="." mode="RefText" />
                      </p>
                    </td>
                  </tr>
                </tbody>
              </table>
              <!--<p class="reference" id="{@id}" style="margin-left: 0.8cm; text-indent: -0.8cm;">
                <span style="width: 0.8cm; display: inline-block; margin-left: 0cm; text-indent: 0cm;">
                  <xsl:text>[</xsl:text>
                  <xsl:value-of select="position()"/>
                  <xsl:text>] </xsl:text>
                </span>
                <xsl:apply-templates select="." mode="RefText" />
              </p>-->
              <!--
              <table align="left" style="width: 0.8cm; margin: 0px;" border="0" cellspacing="0" cellpadding="0">
                <tbody>
                  <tr>
                    <td>
                      <p class="reference" >
                        <xsl:attribute name="style">
                          <xsl:choose>
                            <xsl:when test="/ShowPage/Modus='export'">margin-left: 0px; margin-bottom: -20px;</xsl:when>
                            <xsl:otherwise>margin-left: 0px; margin-bottom: -20px;margin-top: 0px;</xsl:otherwise>
                          </xsl:choose>
                        </xsl:attribute>
                        <xsl:text>[</xsl:text>
                        <xsl:value-of select="position()"/>
                        <xsl:text>] </xsl:text>
                      </p>
                    </td>
                  </tr>
                </tbody>
              </table>
              <p class="reference" id="{@id}">
                <xsl:apply-templates select="." mode="RefText" />
              </p>
              -->
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:when test="/ShowPage/xCiteMode='inlineNA'">
        <table class="References" cellpadding="0" cellspacing="0" width="624">
          <xsl:for-each select="//a[starts-with(@class,'Cite')]">
            <tr valign="top" id="{@id}" class="reference">
              <td valgin="top">
                <xsl:text>[</xsl:text>
                <xsl:value-of select="position()"/>
                <xsl:text>]</xsl:text>
              </td>
              <td valgin="top" width="580">
                <xsl:variable name="id" select="substring-after(@href,'?f=')"/>
                <xsl:apply-templates select="//Subobj[@id=$id]" mode="RefText"/>
                <xsl:value-of select="substring-after(.,']')"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:when test="/ShowPage/xCiteMode[.='short' or .='long' or .='inline']">
        <xsl:for-each select="descendant-or-self::Subobj[sTemplate='NextBib.xsl' and not(Body/xListNode!='') and (
                        (concat('?f=',@id) = //a/@href) or 
                        (concat('?f=',@link) = //a/@href) or 
                            $showall = 1 or
                        count(Subobj[concat('?f=',@id) = //a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']]/@href]) or
                        (count(//a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']])=0)
                    )]">
          <xsl:sort select="@id"/>
          <xsl:variable name="link" select="@link"/>
          <xsl:variable name="id" select="@id"/>
          <xsl:choose>
            <xsl:when test="@link = //Subobj/@id"/>
            <xsl:when test="count(//Subobj[@id > $id and @link = $link])"/>
            <xsl:when test="ancestor::Subobj/preceding::Subobj/descendant-or-self::Subobj/@id = $id"/>

            <xsl:otherwise>
              <p class="reference" id="{@id}">
                <!--
								<a href="?f={@id}" target="_blank">
								</a>                                
                                -->
                <xsl:apply-templates select="." mode="RefText" />

              </p>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:when test="/ShowPage/xCiteMode[.='shorty' or .='inliney' or .='inlinea' or .='inlineLNI']">
        <xsl:for-each select="descendant-or-self::Subobj[sTemplate='NextBib.xsl' and not(Body/xListNode!='') and (
                        (concat('?f=',@id) = //a/@href) or 
                        (concat('?f=',@link) = //a/@href) or 
                            $showall = 1 or
                        count(Subobj[concat('?f=',@id) = //a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']]/@href]) or
                        (count(//a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']])=0)
                    )]">
          <xsl:sort select="substring-before(sTitle,'[')"/>
          <xsl:sort select=".//xYear"/>
          <xsl:sort select="@id" data-type="number"/>
          <xsl:variable name="link" select="@link"/>
          <xsl:variable name="id" select="@id"/>
          <xsl:choose>
            <xsl:when test="@link = //Subobj/@id"/>
            <xsl:when test="count(//Subobj[@id > $id and @link = $link])"/>
            <xsl:when test="ancestor::Subobj/preceding::Subobj/descendant-or-self::Subobj/@id = $id"/>
            <xsl:when test="/ShowPage/xCiteMode='inlinea'">
              <p class="reference" id="{@id}">
                <xsl:apply-templates select="." mode="biblio_doc"/>
              </p>
            </xsl:when>
            <xsl:otherwise>
              <p class="reference" id="{@id}">
                <xsl:apply-templates select="." mode="RefText"/>
              </p>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <!-- number -->
        <table class="References" width="624">
          <tr>
            <td colspan="2">
              <xsl:apply-templates select="mRichtext|Richtext"/>
            </td>
          </tr>
          <xsl:for-each select="Subobj">
            <tr valign="top" id="{@id}" class="reference">
              <td nowrap="nowrap">
                <a href="?f={@id}" target="_blank">
                </a>
                <xsl:text>[</xsl:text>
                <xsl:value-of select="Number"/>
                <xsl:text>]</xsl:text>

              </td>
              <td width="580">
                <xsl:apply-templates select="mRichtext|Richtext"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="Subobj|ShowPage" mode="firstyear">
    <xsl:value-of select="substring-before(sTitle,'[')"/>
    <xsl:value-of select=".//xYear"/>
  </xsl:template>
  <xsl:template match="Subobj" mode="biblio_doc">
    <!-- Authors -->
    <xsl:variable name="authors">
      <xsl:choose>
        <xsl:when test=".//xAuthor != ''">
          <xsl:apply-templates mode="ns" select=".//xAuthor"/>
        </xsl:when>
        <xsl:when test="string-length(..//xEditor) and ..//xType='Book'">
          <xsl:apply-templates mode="ns" select=".//xEditor"/>
          <xsl:if test="not(contains(.//xEditor,'(')) and not(contains(.//xEditor,' eds.'))">
            <xsl:text> </xsl:text>
            <xsl:value-of select="$lsEditor"/>
          </xsl:if>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="string-length($authors) > 0">
        <xsl:value-of select="$authors"/>
      </xsl:when>
      <xsl:when test="string-length(.//xPublisher)">
        <xsl:apply-templates mode="ns" select=".//xPublisher"/>
      </xsl:when>
      <xsl:when test="string-length(.//xPublication)">
        <xsl:apply-templates mode="ns" select=".//xPublication"/>
      </xsl:when>
      <xsl:when test="/ShowPage/xCiteMode='short'">
        <xsl:value-of select="$lsNoAuthor"/>
      </xsl:when>
    </xsl:choose>
    <!-- Year -->
    <xsl:text> (</xsl:text>
    <xsl:apply-templates mode="ns" select=".//xYear"/>
    <xsl:text>): </xsl:text>
    <!-- Title -->
    <xsl:variable name="xTe" select="substring(.//xTitle,string-length(.//xTitle))"/>
    <xsl:apply-templates mode="ns" select=".//xTitle"/>
    <xsl:if test="not(contains('.!?',$xTe))">
      <xsl:text>.</xsl:text>
    </xsl:if>
    <xsl:text> </xsl:text>
    <!-- publication -->
    <xsl:variable name="publication">
      <xsl:apply-templates select="Body" mode="publication">
        <xsl:with-param name="authors" select="$authors"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:if test="string-length($publication) > 0">
      <xsl:text> </xsl:text>
      <xsl:apply-templates select="Body" mode="publication">
        <xsl:with-param name="authors" select="$authors"/>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:variable name="rest">
      <xsl:apply-templates select="Body" mode="web">
        <xsl:with-param name="jetzt">
          <xsl:apply-templates select="Body" mode="date">
            <xsl:with-param name="jetzt">
              <xsl:apply-templates select="Body" mode="address">
                <xsl:with-param name="jetzt">
                  <xsl:apply-templates select="Body" mode="publisher">
                    <xsl:with-param name="authors" select="$authors"/>
                    <xsl:with-param name="jetzt">
                      <xsl:apply-templates select="Body" mode="issbn">
                        <xsl:with-param name="jetzt">
                          <xsl:apply-templates select="Body" mode="edition" />
                        </xsl:with-param>
                      </xsl:apply-templates>
                    </xsl:with-param>
                  </xsl:apply-templates>
                </xsl:with-param>
              </xsl:apply-templates>
            </xsl:with-param>
          </xsl:apply-templates>
        </xsl:with-param>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:if test="$publication != '' and $rest !=''">, </xsl:if>
    <xsl:value-of select="$rest"/>
  </xsl:template>
  <xsl:template match="Body" mode="issbn">
    <xsl:param name="jetzt" />
    <xsl:variable name="data">
      <xsl:choose>
        <xsl:when test="string-length(xISBN) = 0"/>
        <xsl:when test="string-length(xISBN) = 9 and substring(xISBN,5,1)='-'">
          <xsl:text>ISSN </xsl:text>
          <xsl:apply-templates mode="ns" select="xISBN"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>ISBN </xsl:text>
          <xsl:apply-templates mode="ns" select="xISBN"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of select="$jetzt"/>
    <xsl:if test="string-length($jetzt) and string-length($data)">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="$data"/>
  </xsl:template>
  <xsl:template match="Body" mode="publisher">
    <xsl:param name="jetzt" />
    <xsl:param name="authors"/>
    <xsl:variable name="data">
      <xsl:if test="string-length($authors) > 0 and string-length(.//xPublisher)">
        <xsl:apply-templates mode="ns" select=".//xPublisher"/>
      </xsl:if>
    </xsl:variable>
    <xsl:value-of select="$jetzt"/>
    <xsl:if test="string-length($jetzt) and string-length($data)">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="$data"/>
  </xsl:template>
  <xsl:template match="Body" mode="edition">
    <xsl:param name="jetzt" />
    <xsl:variable name="data">
      <xsl:if test="xType='Book' and string-length(xEdition)">
        <xsl:apply-templates mode="ns" select="xEdition"/>
      </xsl:if>
    </xsl:variable>
    <xsl:value-of select="$jetzt"/>
    <xsl:if test="string-length($jetzt) and string-length($data)">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="$data"/>
  </xsl:template>
  <xsl:template match="Body" mode="address">
    <xsl:param name="jetzt" />
    <xsl:value-of select="$jetzt"/>
    <xsl:if test="string-length($jetzt) and string-length(xAddress)">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="xAddress"/>
  </xsl:template>
  <xsl:template match="Body" mode="date">
    <xsl:param name="jetzt" />
    <xsl:value-of select="$jetzt"/>
    <xsl:if test="$jetzt!='' and xDate!=''">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="xDate"/>
  </xsl:template>
  <xsl:template match="Body" mode="web">
    <xsl:param name="jetzt" />
    <xsl:variable name="data">
      <xsl:if test="xType='Web' and string-length(xURL)">
        <xsl:value-of select="xURL"/>
        <xsl:if test="string-length(xEdition)">
          <xsl:text> (</xsl:text>
          <xsl:value-of select=".//xEdition"/>
          <xsl:text>)</xsl:text>
        </xsl:if>
      </xsl:if>
    </xsl:variable>
    <xsl:value-of select="$jetzt"/>
    <xsl:if test="string-length($jetzt) and string-length($data)">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="$data"/>
  </xsl:template>
  <xsl:template match="Body" mode="publication">
    <xsl:param name="authors" />
    <xsl:if test="$authors != '' or xPublisher !=''">

      <xsl:choose>
        <xsl:when test="string-length(xPublication)">
          <xsl:if test="string-length(xEditor)">
            <xsl:apply-templates mode="ns" select="xEditor"/>
            <xsl:if test="not(contains(xEditor,'(')) and not(contains(xEditor,' eds.'))">
              <xsl:text> </xsl:text>
              <xsl:value-of select="$lsEditor"/>
            </xsl:if>
            <xsl:text>: </xsl:text>
          </xsl:if>
          <i class="bibi">
            <xsl:apply-templates mode="ns" select="xPublication"/>
            <xsl:if test="string-length(xSeries)">
              <xsl:text>, </xsl:text>
              <xsl:apply-templates mode="ns" select="xSeries"/>
            </xsl:if>
          </i>
        </xsl:when>
        <xsl:when test="string-length(xSeries)">
          <xsl:text>, </xsl:text>
          <xsl:apply-templates mode="ns" select="xSeries"/>
          <xsl:if test="string-length(xEditor)">
            <xsl:apply-templates mode="ns" select="xEditor"/>
            <xsl:if test="not(contains(xEditor,'(')) and not(contains(xEditor,' eds.'))">
              <xsl:text>, </xsl:text>
              <xsl:value-of select="$lsEditor"/>
            </xsl:if>
          </xsl:if>
        </xsl:when>
      </xsl:choose>
      <xsl:choose>
        <xsl:when test="string-length(xVolume)">
          <xsl:text>, </xsl:text>
          <xsl:choose>
            <xsl:when test="contains(xVolume,'(')" >
              <span class="xVolume">
                <xsl:value-of select="normalize-space(substring-before(xVolume,'('))"/>
              </span>
              <xsl:value-of select="concat('(',normalize-space(substring-after(xVolume,'(')))"/>
            </xsl:when>
            <xsl:otherwise>
              <span class="xVolume">
                <xsl:value-of select="normalize-space(xVolume)"/>
              </span>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:if test="string-length(xPages)">
            <xsl:text>: </xsl:text>
            <xsl:apply-templates mode="ns" select="xPages"/>
          </xsl:if>
        </xsl:when>
        <xsl:when test="string-length(xPages)">
          <xsl:text> </xsl:text>
          <xsl:apply-templates mode="ns" select="xPages"/>
        </xsl:when>
      </xsl:choose>

    </xsl:if>
  </xsl:template>
  <xsl:template match="xDate">
    <xsl:variable name="xD" select="normalize-space(.)"/>
    <xsl:variable name="l" select="string-length($xD)"/>
    <xsl:choose>
      <xsl:when test="translate(substring($xD,$l - 5),' 01234567890:','') = ''">
        <xsl:value-of select="substring($xD,1,$l - 6)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$xD"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="Subobj" mode="RefText">
    <!--
		<a href="?f={@id}" target="_blank">
		</a>		
        -->
    <xsl:variable name="id" select="@id" />
    <xsl:choose>
      <xsl:when test="count(//tr[@class='reference' and @id=$id]) = 1">
        <!-- for mode: InLine 25.02.2023 -->
        <xsl:if test="/ShowPage/xCiteMode='inliney'">
          <b>
            <xsl:value-of select="//tr[@class='reference' and @id=$id]/td[1]/node()" />
          </b>
          <xsl:text> </xsl:text>
        </xsl:if>
        <!-- using existing definition; originally: ".../td[2] 15.11.205" -->
        <xsl:apply-templates select="//tr[@class='reference' and @id=$id]/td[2]/node()" />
      </xsl:when>
      <xsl:when test="sTemplate='NextBib.xsl'">
        <xsl:apply-templates select="." mode="bibliography"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="mRichtext|Richtext"/>
      </xsl:otherwise>
    </xsl:choose>

  </xsl:template>
  <xsl:template match="ShowPage" mode="CiteNumber">
    <xsl:param name="sid"/>
    <xsl:for-each select="descendant-or-self::Subobj[sTemplate='NextBib.xsl' and not(Body/xListNode!='') and ((concat('?f=',@id) = //a/@href) or (concat('?f=',@link) = //a/@href) or count(Subobj[concat('?f=',@id) = //a[@class[.='CiteDir' or .='CiteInd' or .='CiteDirPlus']]/@href]))]">
      <xsl:sort select="sTitle"/>
      <xsl:variable name="link" select="@link"/>
      <xsl:variable name="id" select="@id"/>
      <xsl:if test="$id = $sid">
        <xsl:value-of select="position()"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template match="Subobj" mode="abc">
    <xsl:param name="id" select="@id"/>
    <xsl:param name="author" select="substring-before(sTitle,' [')"/>
    <xsl:param name="year" select=".//xYear"/>
    <xsl:param name="count" select="count(//@id[. &lt; $id and substring-before(../sTitle,' [') = $author and ..//xYear = $year])"/>
    <xsl:if test="$count > 0">
      <xsl:value-of select="substring('abcdefghij',$count,1)"/>
    </xsl:if>
  </xsl:template>
  <!-- ############################# Param  ##################################  -->
  <xsl:param name="lsFunctions">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">选用功能：</xsl:when>
      <xsl:when test="$lsLanguage='de'">Funktionen: </xsl:when>
      <xsl:otherwise>Functions: </xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsCiteMode">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">引用格式</xsl:when>
      <xsl:when test="$lsLanguage='de'">Zitierform</xsl:when>
      <xsl:otherwise>Cite Mode</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsCitePrefix">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">引用语言</xsl:when>
      <xsl:when test="$lsLanguage='de'">Zitiersprache</xsl:when>
      <xsl:otherwise>Cite Language </xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsShort">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">短</xsl:when>
      <xsl:when test="$lsLanguage='de'">Kurz</xsl:when>
      <xsl:otherwise>Short</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsShortY">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">短/年</xsl:when>
      <xsl:when test="$lsLanguage='de'">Kurz/Jahr</xsl:when>
      <xsl:otherwise>Short/Year</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsLong">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">长</xsl:when>
      <xsl:when test="$lsLanguage='de'">Lang</xsl:when>
      <xsl:otherwise>Long</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsInline">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">行中</xsl:when>
      <xsl:when test="$lsLanguage='de'">Inline</xsl:when>
      <xsl:otherwise>Inline</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsInlineN">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">编号(作者名顺序)</xsl:when>
      <xsl:when test="$lsLanguage='de'">Nummer (alphabet.)</xsl:when>
      <xsl:otherwise>Number</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsInlineNA">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">编号(显示顺序)</xsl:when>
      <xsl:when test="$lsLanguage='de'">Nummer (Erscheinungsreihenfolge)</xsl:when>
      <xsl:otherwise>Number (appearence order)</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsInlineA">APA</xsl:param>
  <xsl:param name="lsInlineY">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">行中/年</xsl:when>
      <xsl:when test="$lsLanguage='de'">Inline/Jahr</xsl:when>
      <xsl:otherwise>Inline/Year</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsSectionNumber">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">章节编号</xsl:when>
      <xsl:when test="$lsLanguage='de'">Abschnittsnummerierung</xsl:when>
      <xsl:otherwise>Section Number</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsStandard">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">标准</xsl:when>
      <xsl:when test="$lsLanguage='de'">Standard</xsl:when>
      <xsl:otherwise>Standard</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsNone">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">无</xsl:when>
      <xsl:when test="$lsLanguage='de'">Keine</xsl:when>
      <xsl:otherwise>None</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsExport">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">输出全文</xsl:when>
      <xsl:when test="$lsLanguage='de'">Exportieren</xsl:when>
      <xsl:otherwise>Export</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsWP">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">文件编辑</xsl:when>
      <xsl:when test="$lsLanguage='de'">Textverarbeitung</xsl:when>
      <xsl:otherwise>Word Processor</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsWPStrict">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">统一格式</xsl:when>
      <xsl:when test="$lsLanguage='de'">Einheitl. Formatierung</xsl:when>
      <xsl:otherwise>Unified formatting</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsLaTeX">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">TeX</xsl:when>
      <xsl:when test="$lsLanguage='de'">TeX</xsl:when>
      <xsl:otherwise>TeX</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsBibTeX">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">BibTeX</xsl:when>
      <xsl:when test="$lsLanguage='de'">BibTeX</xsl:when>
      <xsl:otherwise>BibTeX</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsCiteInd">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">参见： </xsl:when>
      <xsl:when test="$lsLanguage='de'">
        <xsl:text>Vgl. </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>See </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsCiteIndPlus">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">如参见：</xsl:when>
      <xsl:when test="$lsLanguage='de'">
        <xsl:text>Vgl. u.a. </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>See, e.g., </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsView">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">显示</xsl:when>
      <xsl:when test="$lsLanguage='de'">Anzeigen</xsl:when>
      <xsl:otherwise>View</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsEntireDoc">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">全文</xsl:when>
      <xsl:when test="$lsLanguage='de'">Gesamtes Dokument</xsl:when>
      <xsl:otherwise>the entire document</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsOutline">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">文章结构</xsl:when>
      <xsl:when test="$lsLanguage='de'">Gliederung</xsl:when>
      <xsl:otherwise>outline mode</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsCombined">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">组合显示</xsl:when>
      <xsl:when test="$lsLanguage='de'">Kombi-Modus</xsl:when>
      <xsl:otherwise>combined mode</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsImport">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">导入文件</xsl:when>
      <xsl:when test="$lsLanguage='de'">Importieren</xsl:when>
      <xsl:otherwise>Import</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsExam">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">测验</xsl:when>
      <xsl:when test="$lsLanguage='de'">Aufgaben</xsl:when>
      <xsl:otherwise>Exam</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsBlock">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">节</xsl:when>
      <xsl:when test="$lsLanguage='de'">Block</xsl:when>
      <xsl:otherwise>Section</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsShowReferences">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">文献</xsl:when>
      <xsl:when test="$lsLanguage='de'">Literatur</xsl:when>
      <xsl:otherwise>references</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="lsEtc">
    <xsl:choose>
      <xsl:when test="$lsLanguage='zh-cn'">其他内容</xsl:when>
      <xsl:when test="$lsLanguage='de'">Weitere Elemente</xsl:when>
      <xsl:otherwise>Further elements</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
</xsl:stylesheet>
