| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 | <?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                version="1.0"><xsl:output method="html"/><xsl:param name="max.toc.width" select="7"/><xsl:template match="toc/title|tocentry/title|titleabbrev">  <xsl:apply-templates/></xsl:template><xsl:template match="toc">  <xsl:param name="pageid" select="@id"/>  <xsl:variable name="relpath">    <xsl:call-template name="toc-rel-path">      <xsl:with-param name="pageid" select="$pageid"/>    </xsl:call-template>  </xsl:variable>  <xsl:variable name="homebanner"                select="/autolayout/config[@param='homebanner'][1]"/>  <xsl:variable name="banner"                select="/autolayout/config[@param='banner'][1]"/>  <xsl:variable name="homebannertext"                select="/autolayout/config[@param='homebannertext'][1]"/>  <xsl:variable name="bannertext"                select="/autolayout/config[@param='bannertext'][1]"/>  <xsl:choose>    <xsl:when test="$pageid = @id">      <xsl:choose>        <xsl:when test="$homebanner">          <img border="0">            <xsl:attribute name="src">              <xsl:value-of select="$relpath"/>              <xsl:value-of select="$homebanner/@value"/>            </xsl:attribute>            <xsl:attribute name="alt">              <xsl:value-of select="$homebanner/@altval"/>            </xsl:attribute>          </img>          <xsl:value-of select="$currentpage.marker"/>        </xsl:when>        <xsl:when test="$homebannertext">          <xsl:value-of select="$homebannertext/@value"/>          <xsl:value-of select="$currentpage.marker"/>        </xsl:when>        <xsl:otherwise>          <xsl:call-template name="gentext.nav.home"/>          <xsl:value-of select="$currentpage.marker"/>        </xsl:otherwise>      </xsl:choose>    </xsl:when>    <xsl:otherwise>      <a href="{$relpath}{@dir}{$filename-prefix}{@filename}">        <xsl:choose>          <xsl:when test="$banner">            <img border="0">              <xsl:attribute name="src">                <xsl:value-of select="$relpath"/>                <xsl:value-of select="$banner/@value"/>              </xsl:attribute>              <xsl:attribute name="alt">                <xsl:value-of select="$banner/@altval"/>              </xsl:attribute>            </img>          </xsl:when>          <xsl:when test="$bannertext">            <xsl:value-of select="$bannertext/@value"/>          </xsl:when>          <xsl:otherwise>            <xsl:call-template name="gentext.nav.home"/>          </xsl:otherwise>        </xsl:choose>      </a>    </xsl:otherwise>  </xsl:choose>  <xsl:text> | </xsl:text>  <xsl:call-template name="process-children">    <xsl:with-param name="pageid" select="$pageid"/>    <xsl:with-param name="relpath" select="$relpath"/>  </xsl:call-template></xsl:template><xsl:template match="tocentry">  <xsl:param name="pageid" select="@id"/>  <xsl:param name="relpath" select="''"/>  <xsl:if test="preceding-sibling::tocentry">    <xsl:text> | </xsl:text>  </xsl:if>  <xsl:choose>    <xsl:when test="$pageid = @id">      <xsl:choose>        <xsl:when test="titleabbrev">          <xsl:apply-templates select="titleabbrev"/>        </xsl:when>        <xsl:otherwise>          <xsl:apply-templates select="title"/>        </xsl:otherwise>      </xsl:choose>      <xsl:value-of select="$currentpage.marker"/>    </xsl:when>    <xsl:otherwise>      <a>        <xsl:attribute name="href">          <xsl:choose>            <xsl:when test="@href">              <xsl:value-of select="@href"/>            </xsl:when>            <xsl:otherwise>              <xsl:value-of select="$relpath"/>              <xsl:value-of select="@dir"/>              <xsl:value-of select="$filename-prefix"/>              <xsl:value-of select="@filename"/>            </xsl:otherwise>          </xsl:choose>        </xsl:attribute>        <xsl:choose>          <xsl:when test="titleabbrev">            <xsl:apply-templates select="titleabbrev"/>          </xsl:when>          <xsl:otherwise>            <xsl:apply-templates select="title"/>          </xsl:otherwise>        </xsl:choose>      </a>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template match="toc|tocentry|notoc" mode="toc-rel-path">  <xsl:call-template name="toc-rel-path"/></xsl:template><xsl:template name="toc-rel-path">  <xsl:param name="pageid" select="@id"/>  <xsl:variable name="entry" select="$autolayout//*[@id=$pageid]"/>  <xsl:variable name="filename" select="concat($entry/@dir,$entry/@filename)"/>  <xsl:variable name="depth">    <xsl:call-template name="toc-directory-depth">      <xsl:with-param name="filename" select="$filename"/>    </xsl:call-template>  </xsl:variable>  <xsl:if test="$depth > 0">    <xsl:call-template name="copy-string">      <xsl:with-param name="string">../</xsl:with-param>      <xsl:with-param name="count" select="$depth"/>    </xsl:call-template>  </xsl:if></xsl:template><xsl:template name="toc-directory-depth">  <xsl:param name="filename"></xsl:param>  <xsl:param name="count" select="0"/>  <xsl:choose>    <xsl:when test='contains($filename,"/")'>      <xsl:call-template name="toc-directory-depth">        <xsl:with-param name="filename"                        select="substring-after($filename,'/')"/>        <xsl:with-param name="count" select="$count + 1"/>      </xsl:call-template>    </xsl:when>    <xsl:otherwise>      <xsl:value-of select="$count"/>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template name="process-children">  <xsl:param name="pageid" select="@id"/>  <xsl:param name="relpath" select="''"/>  <xsl:choose>    <xsl:when test="tocentry[descendant-or-self::*[@id=$pageid]]">      <xsl:call-template name="process-tocentry-children">        <xsl:with-param name="pageid" select="$pageid"/>        <xsl:with-param name="relpath" select="$relpath"/>      </xsl:call-template>    </xsl:when>    <xsl:otherwise>      <xsl:call-template name="process-toc-children">        <xsl:with-param name="pageid" select="$pageid"/>        <xsl:with-param name="relpath" select="$relpath"/>      </xsl:call-template>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template name="process-tocentry-children">  <xsl:param name="pageid" select="@id"/>  <xsl:param name="relpath" select="''"/>  <xsl:choose>    <xsl:when test="count(tocentry) > $max.toc.width">      <xsl:variable name="cur"                    select="tocentry[descendant-or-self::*[@id=$pageid]]"/>      <xsl:variable name="half" select="$max.toc.width div 2"/>      <xsl:variable name="all-nodes"                    select="$cur/preceding-sibling::tocentry[position() < $half]                            | $cur                            | $cur/following-sibling::tocentry"/>      <xsl:variable name="nodes"                    select="$all-nodes[position() < $max.toc.width]"/>      <xsl:if test="count($cur/preceding-sibling::tocentry) > $half">        <xsl:text>...</xsl:text>      </xsl:if>      <xsl:apply-templates select="$nodes">        <xsl:with-param name="pageid" select="$pageid"/>        <xsl:with-param name="relpath" select="$relpath"/>      </xsl:apply-templates>      <xsl:if test="count($all-nodes) > $max.toc.width">        <xsl:text> | ...</xsl:text>      </xsl:if>    </xsl:when>    <xsl:otherwise>      <xsl:apply-templates select="tocentry">        <xsl:with-param name="pageid" select="$pageid"/>        <xsl:with-param name="relpath" select="$relpath"/>      </xsl:apply-templates>    </xsl:otherwise>  </xsl:choose>  <br/>  <!-- if the current page isn't in this list, keep digging... -->  <xsl:if test="not(tocentry[$pageid=@id])">    <xsl:for-each select="tocentry">      <xsl:if test="descendant::*[@id=$pageid]">        <xsl:call-template name="process-children">          <xsl:with-param name="pageid" select="$pageid"/>          <xsl:with-param name="relpath" select="$relpath"/>        </xsl:call-template>      </xsl:if>    </xsl:for-each>  </xsl:if></xsl:template><xsl:template name="process-toc-children">  <xsl:param name="pageid" select="@id"/>  <xsl:param name="relpath" select="''"/>  <xsl:choose>    <xsl:when test="count(tocentry) > $max.toc.width">      <xsl:variable name="half" select="$max.toc.width div 2"/>      <xsl:variable name="all-nodes" select="tocentry"/>      <xsl:variable name="nodes"                    select="$all-nodes[position() < $max.toc.width]"/>      <xsl:apply-templates select="$nodes">        <xsl:with-param name="pageid" select="$pageid"/>        <xsl:with-param name="relpath" select="$relpath"/>      </xsl:apply-templates>      <xsl:if test="count($all-nodes) > $max.toc.width">        <xsl:text> | ...</xsl:text>      </xsl:if>    </xsl:when>    <xsl:otherwise>      <xsl:apply-templates select="tocentry">        <xsl:with-param name="pageid" select="$pageid"/>        <xsl:with-param name="relpath" select="$relpath"/>      </xsl:apply-templates>    </xsl:otherwise>  </xsl:choose>  <br/></xsl:template></xsl:stylesheet>
 |