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

<!--
$Id: macros.xsl 9995 2010-12-14 14:34:48Z smoeser $

Common pieces of documentation processing stylesheets
-->

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns="http://www.w3.org/1999/xhtml"
	xmlns:pm="http://www.polymake.de/ns/docs#3"
>

<xsl:variable name="version_text">
  <xsl:apply-templates mode="version" select="document('version.xml')/*"/>
</xsl:variable>

<xsl:template name="nav-box">
	<div class="sidebar">
		<div class="sidebox">
			<h1>Navigation</h1>
			<ul>
				<li> <a href="index.html#apps">applications</a> </li>
				<li> <a href="core.html">core functionality</a></li>
				<li> <a href="doc_index.html">index</a> </li>
          <!-- FIXME: remove the condition as soon as the doxygen documentation ripens enough to be published without disgrace -->
           		 <xsl:if test="contains($version_text,'snapshot')">
					<li> <a href="PTL/index.html">PTL</a></li>
           		 </xsl:if>
            	<xsl:if test="contains($version_text,'snapshot')">
					<li> <a href="http://polymake.mathematik.tu-darmstadt.de/release_docs/">release documentation</a></li>
            	</xsl:if>
			</ul>  
		</div>  
	</div>
</xsl:template>

<xsl:template name="wiki-ref">
  <xsl:param name="reftext" />
  <xsl:element name="a">
    <xsl:attribute name="href">
      <xsl:value-of select="$Wiki"/>
    </xsl:attribute>
    <xsl:value-of select="$reftext" />
  </xsl:element>
</xsl:template>

<xsl:template mode="version" match="/pm:version">
  <xsl:apply-templates mode="version" select="*" /><xsl:if test="not(pm:extensions)">.</xsl:if>
</xsl:template>

<xsl:template mode="version" match="pm:revision">
  <xsl:text> extracted from svn snapshot </xsl:text> <xsl:value-of select="normalize-space(current())"/>
</xsl:template>

<xsl:template mode="version" match="pm:release">
  <xsl:text> as of release </xsl:text> <xsl:value-of select="normalize-space(current())"/>
</xsl:template>

<xsl:template mode="version" match="pm:extensions">
  <xsl:text> with the following individual extensions:</xsl:text>
  <ul class="ext">
    <xsl:for-each select="pm:extension">
      <li> <xsl:value-of select="current()" /> </li>
    </xsl:for-each>
  </ul>
</xsl:template>
  
</xsl:stylesheet>
