paperFormat.xsl
Created with JBuilder
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
  Style sheet that builds a nice thesis from the "draft"-XHTML file!
  Author: Holger (David) Wagner, 2002-02-09
-->
<!-- DOCTYPE stylesheet [ -->
<!-- ENTITY space "<xsl:text> </xsl:text>" -->
<!-- ENTITY auml "ä">
<!ENTITY ouml "ö">
<!ENTITY uuml "ü">
<!ENTITY Uuml "Ü">
<!ENTITY Ouml "Ö">
<!ENTITY Auml "Ä">
<!ENTITY ldquo   "“">
<!ENTITY rdquo   "”">
] -->
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:srf="http://www.xml-formats.org/ns/SRF"
                xmlns:bml="http://www.xml-formats.org/ns/BML">
  <xsl:output method="html"
              doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
              doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
              encoding="iso-8859-1"
              indent="no" />

  <!-- The HTML-PMS-Paper frame is at the end of the stylesheet for simplicity -->

  <!-- build the Table of Contents -->
  <xsl:template match="srf:appendix|srf:section|srf:subsection|srf:subsubsection" mode="toc">
    <xsl:variable name="tocID" select="@id" />
    <xsl:variable name="headingTag">
      <xsl:choose>
        <xsl:when test="local-name() = 'section' or local-name() = 'appendix'">h2</xsl:when>
        <xsl:when test="local-name() = 'subsection'">h3</xsl:when>
        <xsl:when test="local-name() = 'subsubsection'">h4</xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:element name="{$headingTag}">
      <a href="#{$tocID}">
        <xsl:number level="multiple"
                    count="srf:section|srf:subsection|srf:subsubsection"
                    format="1.1.1 " />
        <xsl:value-of select="@title" />
      </a>
    </xsl:element>
    <xsl:apply-templates select="srf:section|srf:subsection|srf:subsubsection" mode="toc" />
  </xsl:template>


  <!-- Format the actual contents, section by section -->
  <xsl:template match="srf:appendix|srf:section|srf:subsection|srf:subsubsection">
    <xsl:variable name="tocID" select="@id" />
    <xsl:variable name="headingTag">
      <xsl:choose>
        <xsl:when test="local-name() = 'section' or local-name() = 'appendix'">h2</xsl:when>
        <xsl:when test="local-name() = 'subsection'">h3</xsl:when>
        <xsl:when test="local-name() = 'subsubsection'">h4</xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:element name="{$headingTag}">
      <xsl:if test="$headingTag = 'h2'">
        <xsl:attribute name="class">section</xsl:attribute>
      </xsl:if>
      <a id="{$tocID}" name="{$tocID}">
        <xsl:number level="multiple"
                    count="srf:section|srf:subsection|srf:subsubsection"
                    format="1.1.1 " />
        <xsl:value-of select="@title" />
      </a>
    </xsl:element>
    <small><a href="#toc">[toc]</a></small>
    <xsl:apply-templates select="br|p|q|table|ul|ol|blockquote|srf:section|srf:subsection|srf:subsubsection" />
  </xsl:template>

  <!-- Copy most... -->
  <xsl:template match="@*|br|p|a|em|strong|ul|li|tr|th|td|abbr|acronym">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <!-- quotes -->
  <xsl:template match="q">
    “<xsl:apply-templates select="@*|node()" />” (<a href="#@cite"><cite>[<xsl:value-of select="@cite" />]</cite></a>)
    <!-- xsl:copy-of select="." / -->
  </xsl:template>

  <xsl:template match="blockquote">
    <blockquote cite="@cite">
      <p>
        “<xsl:apply-templates select="./p/node()" />” (<a href="#@cite"><cite>[<xsl:value-of select="@cite" />]</cite></a>)
      </p>
    </blockquote>
  </xsl:template>

  <!-- useful especially for printing! -->
  <!-- acronyms and abbreviations -->
  <xsl:template match="acronym | abbr">
    <xsl:copy-of select="." />
    <xsl:text> </xsl:text><em>[<xsl:value-of select="@title" />]</em>
  </xsl:template>

  <!-- links, with cross-references, tighter template is matched (see below) -->
  <xsl:template match="a">
    <xsl:copy-of select="." />
    <xsl:if test="@href">
      <xsl:text> </xsl:text><em>[<xsl:value-of select="@href" />]</em>
    </xsl:if>
  </xsl:template>


  <!-- fix cross-references -->
  <xsl:template match="a[@class='crossRef']">
    <xsl:variable name="target" select="@href" />
    <xsl:apply-templates select="//srf:section[@id=$target]|//srf:subsection[@id=$target]|//srf:subsubsection[@id=$target]"
                         mode="crossRefFull" />
  </xsl:template>

  <!-- used by "fix cross-references" and index builders -->
  <xsl:template match="srf:section|srf:subsection|srf:subsubsection" mode="crossRefFull">
    <xsl:variable name="target" select="@id" />
    <xsl:variable name="title" select="@title" />
    <a href="#{$target}">
      section <xsl:text> </xsl:text>
      <em class="crossRef">
        <xsl:apply-templates select="//srf:section[@id=$target]|//srf:subsection[@id=$target]|//srf:subsubsection[@id=$target]"
                             mode="crossRefNum" />
        <!-- xsl:value-of select="$title" / -->
      </em>
    </a>
  </xsl:template>

  <xsl:template match="srf:section|srf:subsection|srf:subsubsection" mode="crossRefNum">
    <xsl:number level="multiple"
                count="srf:section|srf:subsection|srf:subsubsection"
                format="1.1.1 " />
  </xsl:template>

  <!-- wrap definitions in <a id="DFN" name="DFN">-tags -->
  <!-- surround <dfn>-Tags with <em class="dfn">-tags -->
  <!-- if external URL is given, add this to the <a>-tag -->
  <xsl:template match="dfn">
    <em class="dfn">
      <xsl:element name="a">
        <xsl:attribute name="id">Def_<xsl:value-of select="@id" /></xsl:attribute>
        <xsl:attribute name="name">Def_<xsl:value-of select="@id" /></xsl:attribute>
        <xsl:if test="@href">
          <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
        </xsl:if>
      <!-- a id="Def_{@id}" name="Def_{@id}" -->
        <xsl:copy>
          <xsl:copy-of select="@*" />
          <xsl:apply-templates />
        </xsl:copy>
      <!-- /a -->
      </xsl:element>
    </em>
  </xsl:template>

  <!-- build index of definitions (inside a table) -->
  <xsl:template match="dfn" mode="defIndexTable">
    <xsl:variable name="id" select="@id" />
    <xsl:variable name="sectionID">
      <xsl:choose>
        <xsl:when test="ancestor::srf:subsubsection/@id">
          <xsl:value-of select="ancestor::srf:subsubsection/@id" />
        </xsl:when>
        <xsl:when test="ancestor::srf:subsection/@id">
          <xsl:value-of select="ancestor::srf:subsection/@id" />
        </xsl:when>
        <xsl:when test="ancestor::srf:section/@id">
          <xsl:value-of select="ancestor::srf:section/@id" />
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <tr class="terms">
      <td class="terms">
        <a href="#Def_{$id}">
          <xsl:choose>
            <xsl:when test="@title">
              <xsl:value-of select="@title" />
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="text()" />
            </xsl:otherwise>
          </xsl:choose>
        </a>
      </td>
      <td class="terms">
        <xsl:apply-templates select="//srf:section[@id=$sectionID]|//srf:subsection[@id=$sectionID]|//srf:subsubsection[@id=$sectionID]"
                             mode="crossRefFull" />
      </td>
    </tr>
  </xsl:template>

  <!-- ALTERNATIVE: build index of definitions (as a list) -->
  <xsl:template match="dfn" mode="defIndexList">
    <xsl:variable name="id" select="@id" />
    <xsl:variable name="sectionID">
      <xsl:choose>
        <xsl:when test="ancestor::srf:subsubsection/@id">
          <xsl:value-of select="ancestor::srf:subsubsection/@id" />
        </xsl:when>
        <xsl:when test="ancestor::srf:subsection/@id">
          <xsl:value-of select="ancestor::srf:subsection/@id" />
        </xsl:when>
        <xsl:when test="ancestor::srf:section/@id">
          <xsl:value-of select="ancestor::srf:section/@id" />
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
      <span class="terms">
      <a href="#Def_{$id}">
        <xsl:choose>
          <xsl:when test="@title">
            <xsl:value-of select="@title" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="text()" />
          </xsl:otherwise>
        </xsl:choose>
      </a><xsl:text> (</xsl:text>
      <xsl:apply-templates select="//srf:section[@id=$sectionID]|//srf:subsection[@id=$sectionID]|//srf:subsubsection[@id=$sectionID]"
                           mode="crossRefFull" />)</span><br />
  </xsl:template>

  <!-- enumerate tables -->
  <xsl:template match="table">
    <p><a id="Table_{@id}" name="Table_{@id}"><xsl:text> </xsl:text></a></p>
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <caption style="caption-side:bottom;">
        <strong>
          <xsl:apply-templates select="self::table" mode="tableNumber" />:
          <xsl:value-of select="caption/text()" />
        </strong>
      </caption>
      <xsl:apply-templates select="tr" />
    </xsl:copy>
    <p />
  </xsl:template>

  <xsl:template match="table" mode="tableNumber">
    Table <xsl:text> </xsl:text>
    <xsl:number level="multiple"
                count="srf:section|srf:subsection|srf:subsubsection"
                format="1.1.1" />
    <xsl:if test="preceding-sibling::table or following-sibling::table">
      <xsl:variable name="tableID" select="count(preceding-sibling::table)+1" />
      (<xsl:value-of select="$tableID" />)
    </xsl:if>
  </xsl:template>

  <!-- build index of tables -->
  <xsl:template match="table" mode="tableIndex">
    <tr>
      <td>
        <a href="#Table_{@id}">
          <xsl:apply-templates select="self::table" mode="tableNumber" />
        </a>
      </td>
      <td>
        <strong><xsl:value-of select="caption/text()" /></strong><br />
        <xsl:value-of select="@summary" />
      </td>
    </tr>
  </xsl:template>

  <!-- format bibliography -->

  <xsl:template match="srf:bibliography" mode="bib">
    <xsl:apply-templates select="tr" />
  </xsl:template>

  <!-- These 2 templates make links from all <cite>-tags to the relevant references -->
  <xsl:template match="cite[not(@title)]">
    <xsl:variable name="refe" select="substring(text(),2,string-length(text())-2)" />
    <xsl:variable name="refID" select="count(preceding::cite[not(@title) and text() = concat('[', $refe, ']')])" />
    <a href="#{$refe}" id="{$refe}_{$refID}" name="{$refe}_{$refID}">
      <xsl:copy>
        <xsl:apply-templates />
      </xsl:copy>
    </a>
  </xsl:template>

  <xsl:template match="cite[@title]">
    <xsl:variable name="refe" select="@title" />
    <!-- xsl:variable name="refID" select="count(preceding::cite[@title])" / -->
    <xsl:variable name="refID" select="count(preceding::cite[@title = $refe])" />
    <a href="#{$refe}" id="{$refe}_{$refID}" name="{$refe}_{$refID}">
      <xsl:copy>
        <xsl:apply-templates />
      </xsl:copy>
    </a>
  </xsl:template>
  <!-- ================================================================ -->

  <!-- build references from own file! -->
  <!-- for each reference, build "used at" list -->


  <!-- The HTML-PMS-Paper Frame -->
  <xsl:template match="srf:article">
    <!-- These are the numbers for the Indices and References sections -->
    <!-- xsl:variable name="sectionCountInd" select="count(//srf:section) + 1" />
    <xsl:variable name="sectionCountRef" select="count(//srf:section) + 2" / -->
    <xsl:variable name="sectionCountInd">A</xsl:variable>
    <xsl:variable name="sectionCountRef">B</xsl:variable>

    <xsl:variable name="title"       select="./bml:entry/*/bml:title/text()" />
    <xsl:variable name="date">
      <xsl:value-of select="./bml:entry/*/bml:month/text()" /><xsl:text>, </xsl:text>
      <xsl:value-of select="./bml:entry/*/bml:year/text()" />
    </xsl:variable>
    <xsl:variable name="location"    select="./bml:entry/*/bml:url/text()" />
    <xsl:variable name="authorName">
      <xsl:value-of select="./bml:entry/*/bml:authors/bml:author/@first" /><xsl:text> </xsl:text>
      <xsl:if test="./bml:entry/*/bml:authors/bml:author/@middle">
        <xsl:value-of select="./bml:entry/*/bml:authors/bml:author/@middle" /><xsl:text> </xsl:text>
      </xsl:if>
      <xsl:if test="./bml:entry/*/bml:authors/bml:author/@preLast">
        <xsl:value-of select="./bml:entry/*/bml:authors/bml:author/@preLast" /><xsl:text> </xsl:text>
      </xsl:if>
      <xsl:value-of select="./bml:entry/*/bml:authors/bml:author/@last" />
    </xsl:variable>
    <xsl:variable name="authorEMail" select="./bml:entry/*/bml:authors/bml:author/@eMail" />
    <xsl:variable name="abstract"    select="./bml:entry/*/bml:abstract/text()" />
  <!--
    <xsl:variable name="title"       select="@title"          />
    <xsl:variable name="date"        select="@date"           />
    <xsl:variable name="location"    select="@location"       />
    <xsl:variable name="authorName"  select="author/@name"    />
    <xsl:variable name="authorEMail" select="author/@eMail"   />
    <xsl:variable name="abstract"    select="abstract/text()" />
  -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
    <meta name="Author" content="{$authorName}" />
    <link rel="stylesheet" type="text/css" href="doc.css" />
    <style type="text/css">
/* ====================    project thesis:    ==================== */

body {
  background-color: #FFFFEE;
  margin: 0.5cm;
  font-family: Helvetica, Arial, sans-serif;
}

tr, td, p {
  font-family: Helvetica, Arial, sans-serif;
}

/* Netscape 4.78 does not know the dfn-Tag, em.dfn is a workaround! */
em.dfn, dfn {
  background-color: #FFFF66;
  font-style:italic;
  font-family: Helvetica, Arial, sans-serif;
}

abbr {
  background-color: #FF66FF;
}

acronym {
  background-color: #66FFFF;
}

cite {
  color: #6666FF;
}

body div {
  padding: 0em;
  font-family: Helvetica, Arial, sans-serif;
}

body h1 {
  text-align: center;
  margin: 2cm;
}

body h2.section {
  page-break-before: always;
  padding-top: 2em;
  margin-top: 2em;
  border-top-width: thick;
  border-top-style: groove;
  border-top-color: rgb(128,128,255);
}

p.author {
  text-align: center;
  margin: 2cm;
}

table.references {
  margin-right: 1cm;
  font-size:8pt;
  font-family: Helvetica, Arial, sans-serif;
}

.terms {
  font-size:10pt;
  font-family: Helvetica, Arial, sans-serif;
}

table.references tr {
  font-size:8pt;
  font-family: Helvetica, Arial, sans-serif;
}

table.references tr.unread {
  /* background-color: #FFAAAA; */
  font-family: Helvetica, Arial, sans-serif;
}

table.references tr td {
  font-size:8pt;
  font-family: Helvetica, Arial, sans-serif;
}

td.citeref {
  vertical-align: top;
  font-weight: bold;
  font-family: Helvetica, Arial, sans-serif;
}

td.citation {
  vertical-align: top;
  font-family: Helvetica, Arial, sans-serif;
}

div.contents h2, h3, h4, h5, h6 {
  margin: 0em;
  padding-top: 0em;
  padding-bottom: 0em;
}

div.contents h2 {
  padding-left: 0em;
  font-size: 14pt;
  line-height: 16pt;
}

div.contents h3 {
  padding-left: 2em;
  font-size: 12pt;
  line-height: 14pt;
}

div.contents h4 {
  padding-left: 4em;
  font-size: 10pt;
  line-height: 12pt;
}

div.contents h5 {
  padding-left: 6em;
  font-size: 8pt;
  line-height: 10pt;
}

@media print {
  body {
    background-color: #FFFFFF;
    margin: 0cm;
    font-size: 11pt;
  }

  p, td, cite, pre, li {
    text-align: justify;
    font-size: 11pt;
  }

  body h2.section {
    page-break-before: always;
    padding-top: 0em;
    margin-top: 0em;
    border-top-style: none;
  }

  td.used {
    display: none;
  }

  .noprint {
    display: none;
  }
}

@media screen {
  .printonly {
    display: none;
  }
}

    </style>
    <title><xsl:value-of select="$title" /></title>
  </head>
  <body>
    <p class="center">
      <small>
        <a href="../index.shtml" id="top" name="top">[home]</a>
      </small>
    </p>

    <!-- heading -->
    <p>
      <small>
        This page:
        <a href="{$location}">
          <code><xsl:value-of select="$location" /></code></a>
        <br />
        <a href="{$authorEMail}">
          <i><xsl:value-of select="$authorName" /></i></a>, <xsl:value-of select="$date" />
      </small>
    </p>
    <p>
      <i>
        Lehr- und Forschungseinheit für Programmier- und Modellierungssprachen,
        <br />
        Institut für Informatik der Ludwigs- Maximilians-Universität München
      </i>
    </p>
    <!-- end of heading -->

    <h1><xsl:value-of select="$title" /></h1>

    <p class="author"><xsl:value-of select="$authorName" /></p>

    <h2 class="abstract">Abstract</h2>
    <div class="abstract">
      <blockquote cite="http://www.pms.informatik.uni-muenchen.de/lehre/projekt-diplom-arbeit/navigation-track/doc/thesis.shtml">
        <xsl:value-of select="$abstract" />
      </blockquote>
    </div>
<!--
    <p>
      <strong>Note for readers of the draft version:</strong>
      I am experimenting with some tags that do not have a particular formatting
      in the default browser-stylesheets (e.g. dfn). To make the use of these
      tags more easily visible and make it easier to find logically wrong
      markup, a style-sheet that uses some flashy colors is used. In the
      final version, the formatting will be simpler. The following tags
      are used and should be easily distinguishable:
    </p>
    <ul>
      <li>
        <code><dfn title="Definition tag."><dfn></dfn></code>
        for the defining instance of a term.
        The definition can be additionally given in the <code>title</code>
        attribute.
        As
        <em>Netscape 4.78</em> does not know this tag, it is enclosed with
        <code><em class="dfn"><dfn title="Netscape 4.7 definition tag">
          <em class="dfn"><dfn><em>term</em></dfn></em>
        </dfn></em></code>
      </li>
      <li>
        <code><abbr title="Abbreviation tag."><abbr></abbr></code>
        for abbreviations, e.g. <abbr title="abbreviation">abbr.</abbr>.
        A title attribute must have the full term, which is displayed on
        mouse-over by modern browsers.
      </li>
      <li>
        <code><acronym title="Acronym tag."><acronym></acronym></code>
        for acronyms, e.g. <acronym title="World Wide Web">WWW</acronym>.
        A title attribute must have the full term, which is displayed on
        mouse-over by modern browsers.
      </li>
      <li>
        <code><cite><cite></cite></code>
        for citations and references to other source, e.g.
        <cite>[Cheung]</cite>. Note that these also link to the actual
        reference (by surrounding them with an anchor tag)!
      </li>
    </ul>
-->
    <h2 class="section">
      <a name="toc" id="toc">
        Table of Contents
      </a>
    </h2>
    <div class="contents">
      <xsl:apply-templates select="srf:body/srf:section|srf:body/srf:appendix" mode="toc" />
      <br />
      <h2><a href="#ind">
        <xsl:value-of select="$sectionCountInd" />
        <xsl:text> </xsl:text>
        Indices</a></h2>
      <h3><a href="#termsIndex">
        <xsl:value-of select="$sectionCountInd" />
        <xsl:text>.1 </xsl:text>
        Terms</a></h3>
      <h3><a href="#tablesIndex">
        <xsl:value-of select="$sectionCountInd" />
        <xsl:text>.2 </xsl:text>
        Tables</a></h3>
      <h2><a href="#ref">
        <xsl:value-of select="$sectionCountRef" />
        <xsl:text> </xsl:text>
        References</a></h2>
    </div>

    <!-- paper -->
    <xsl:apply-templates select="srf:body/srf:section|srf:body/srf:appendix" />

    <!-- Indices: Terms and Tables -->
    <h2 class="section"><a id="ind" name="ind">
      <xsl:value-of select="$sectionCountInd" />
      <xsl:text> </xsl:text>
      Indices</a></h2>
    <h3><a id="termsIndex" name="termsIndex">
      <xsl:value-of select="$sectionCountInd" />
      <xsl:text>.1 </xsl:text>
      Terms</a></h3>
    <p>
      The following list gives an overview of all the terms that are
      used throughout this paper including links to the actual
      definitions as well as the sections where they have been given:
    </p>
    <xsl:for-each select="//dfn">
      <xsl:sort data-type="text" select="." />
      <xsl:apply-templates select="." mode="defIndexList" />
    </xsl:for-each>
    <!-- Alternative: with a table -->
    <!-- table width="70%" align="center">
      <tr><th width="70%">Term</th><th width="30%">Defined in...</th></tr>
      <xsl:for-each select="//dfn">
        <xsl:sort data-type="text" select="." />
        <xsl:apply-templates select="." mode="defIndex" />
      </xsl:for-each>
    </table -->
    <p />
    <br />

    <h3><a id="tablesIndex" name="tablesIndex">
      <xsl:value-of select="$sectionCountInd" />
      <xsl:text>.2 </xsl:text>
      Tables</a></h3>
    <p>
      The following table gives an overview of all the tables that
      are included in this paper with a link to the table, its
      caption and a summary describing the contents of the table:
    </p>
    <table>
      <tr><th width="15%">Table</th><th width="85%">Caption / Summary</th></tr>
      <xsl:apply-templates select="//table" mode="tableIndex" />
    </table>


    <!-- References -->
    <h2 class="section"><a id="ref" name="ref">
      <xsl:value-of select="$sectionCountRef" />
      <xsl:text> </xsl:text>
      References</a></h2>

    <table class="references">
      <xsl:variable name="bibfile" select="//srf:bibliography/@src" />
      <xsl:if test="not(document($bibfile))">
        <strong class="pending">
          Could not find or parse bibliography file
          <code><xsl:value-of select="$bibfile" /></code>
        </strong>! Please check the URI and syntax of file!
      </xsl:if>
      <xsl:apply-templates select="document($bibfile)" />
    </table>

    <!-- Page footer -->
    <hr />
    <p>
    <a href="http://www.pms.informatik.uni-muenchen.de/">
      <img alt="PMS" src="home0000.gif"/>
      Lehr- und Forschungseinheit</a>
    <!--                 -->
    <a href="http://www.informatik.uni-muenchen.de/">
      <img alt="IfI" src="home0000.gif"/>
      Institut</a>
    <!--                 -->
    <a href="http://www.uni-muenchen.de/">
      <img alt="LMU" src="home0000.gif"/>
      Universität</a>
    </p>

    <!--#include file="ssi/footer1.txt"-->
    <!--#echo var="LAST_MODIFIED"-->
    <!--#include file="ssi/footer2.txt"-->
  </body>
</html>
  </xsl:template>
</xsl:stylesheet>

paperFormat.xsl
Created with JBuilder