insilmaril@37: <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> insilmaril@37: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl" version="1.0"> insilmaril@37: insilmaril@37: <xsl:template name="getTopicName"> insilmaril@37: <xsl:param name="id"/> insilmaril@37: <xsl:variable name="searching" select="$topics[@id=$id]" /> insilmaril@37: <xsl:variable name="get"><xsl:value-of select="$searching/baseName/baseNameString" /><xsl:value-of select="$searching/@name" /></xsl:variable> insilmaril@37: <xsl:if test="string( $get )"><xsl:value-of select="$get" /></xsl:if> insilmaril@37: <xsl:if test="not(string( $get ))"><span class="notFound"><xsl:value-of select="$id" /> not found.</span></xsl:if> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getParent"> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:call-template name="getAllAssocID"> insilmaril@37: <xsl:with-param name="filter" select="'#group-subgroup'" /> insilmaril@37: <xsl:with-param name="role" select="'#parent'" /> insilmaril@37: <xsl:with-param name="currentID" select="$currentID" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getChild"> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:call-template name="getAllAssocID"> insilmaril@37: <xsl:with-param name="filter" select="'#group-subgroup'" /> insilmaril@37: <xsl:with-param name="role" select="'#child'" /> insilmaril@37: <xsl:with-param name="currentID" select="$currentID" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getAllAssocID"> insilmaril@37: <xsl:param name="filter"/> insilmaril@37: <xsl:param name="role"/> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: insilmaril@37: <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href=$filter][member/topicRef/@xlink:href=concat('#',$currentID)]" /> insilmaril@37: <xsl:variable name="fiddle" select="$theseOnes/member/topicRef[not(@xlink:href=concat('#',$currentID))][parent::*/roleSpec/topicRef/@xlink:href=$role]" /> insilmaril@37: insilmaril@37: <xsl:value-of select="substring-after($fiddle[1]/@xlink:href, '#')" /> insilmaril@37: insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getAllAssoc"> insilmaril@37: <xsl:param name="filter"/> insilmaril@37: <xsl:param name="role"/> insilmaril@37: <xsl:param name="style" select="'default'" /> insilmaril@37: <xsl:param name="title"/> insilmaril@37: <xsl:param name="box"/> insilmaril@37: <xsl:param name="without"/> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:param name="againstID"/> insilmaril@37: insilmaril@37: <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href=$filter][member/topicRef/@xlink:href=concat('#',$currentID)]" /> insilmaril@37: insilmaril@37: <xsl:variable name="found"><xsl:choose> insilmaril@37: <xsl:when test="$style = 'sections'"> insilmaril@37: <table border="0" cellspacing="0" cellpadding="0" class="sections"><tr> insilmaril@37: <xsl:for-each select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]"> insilmaril@37: <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> insilmaril@37: <xsl:variable name="cat" select="concat('#',$currentID)" /> insilmaril@37: <td valign="top" class="{$style}Menu"> insilmaril@37: <a href="{$pre-link}{$thisOne}{$post-link}" class="{$style}MenuLink"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> insilmaril@37: <div class="{$style}MenuContent"><xsl:call-template name="getClue"><xsl:with-param name="currentID" select="$thisOne" /></xsl:call-template></div> insilmaril@37: </td> insilmaril@37: </xsl:for-each> insilmaril@37: </tr></table> insilmaril@37: </xsl:when> insilmaril@37: <xsl:when test="$style = 'news'"> insilmaril@37: <xsl:for-each select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]"> insilmaril@37: <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> insilmaril@37: <xsl:variable name="cat" select="concat('#',$currentID)" /> insilmaril@37: <div class="{$style}Menu"> insilmaril@37: <a href="{$pre-link}{$thisOne}{$post-link}" class="{$style}MenuLink"> insilmaril@37: <xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template> : insilmaril@37: <xsl:call-template name="getClue"><xsl:with-param name="currentID" select="$thisOne" /><xsl:with-param name="style" select="'news'" /></xsl:call-template> insilmaril@37: </a> insilmaril@37: </div> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:when> insilmaril@37: <xsl:when test="$style = 'smallnews'"> insilmaril@37: <xsl:for-each select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]"> insilmaril@37: <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> insilmaril@37: <xsl:variable name="cat" select="concat('#',$currentID)" /> insilmaril@37: <div class="{$style}Menu"> insilmaril@37: <a href="{$pre-link}{$thisOne}{$post-link}" class="{$style}MenuLink"> insilmaril@37: <xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template> : insilmaril@37: <xsl:call-template name="getShort"><xsl:with-param name="currentID" select="$thisOne" /></xsl:call-template> insilmaril@37: </a> insilmaril@37: </div> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:when> insilmaril@37: <xsl:otherwise> insilmaril@37: insilmaril@37: <xsl:variable name="allThese" select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]" /> insilmaril@37: <xsl:for-each select="$allThese"> insilmaril@37: insilmaril@37: <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> insilmaril@37: <xsl:variable name="cat" select="concat('#',$currentID)" /> insilmaril@37: <xsl:choose> insilmaril@37: <xsl:when test="$style = 'right' or $style = 'left' or $style = 'full' or $style = 'tree'"> insilmaril@37: <xsl:choose> insilmaril@37: <xsl:when test="$thisOne = $againstID"> insilmaril@37: <div class="{$style}MenuSelected"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </div> insilmaril@37: </xsl:when> insilmaril@37: <xsl:otherwise> insilmaril@37: <div class="{$style}Menu"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </div> insilmaril@37: </xsl:otherwise> insilmaril@37: </xsl:choose> insilmaril@37: </xsl:when> insilmaril@37: <xsl:when test="$style = 'banner'"> insilmaril@37: <xsl:choose> insilmaril@37: <xsl:when test="$thisOne = $againstID"> insilmaril@37: <td class="{$style}MenuSelected"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </td> insilmaril@37: </xsl:when> insilmaril@37: <xsl:otherwise> insilmaril@37: <td class="{$style}Menu"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </td> insilmaril@37: </xsl:otherwise> insilmaril@37: </xsl:choose> insilmaril@37: </xsl:when> insilmaril@37: <xsl:otherwise> insilmaril@37: <xsl:if test="position() != 1"> / </xsl:if> insilmaril@37: <a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template> </a> insilmaril@37: </xsl:otherwise> insilmaril@37: </xsl:choose> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:otherwise> insilmaril@37: </xsl:choose> insilmaril@37: </xsl:variable> insilmaril@37: <xsl:if test="string($found)"> insilmaril@37: <xsl:choose> insilmaril@37: <xsl:when test="string($box) and $style != 'news' and $style != 'right' and $style != 'left' and $style != 'full' and $style = 'tree' and $style = 'banner'"> insilmaril@37: <table class="{$box}"> insilmaril@37: <tr> insilmaril@37: <xsl:if test="string($title)"><td class="{$box}Title"><xsl:value-of select="$title" /></td></xsl:if> insilmaril@37: <td class="{$box}Content"><xsl:copy-of select="$found" /></td> insilmaril@37: </tr> insilmaril@37: </table> insilmaril@37: </xsl:when> insilmaril@37: <xsl:otherwise> insilmaril@37: <xsl:copy-of select="$found" /> insilmaril@37: </xsl:otherwise> insilmaril@37: </xsl:choose> insilmaril@37: </xsl:if> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getAllAssocTwo"> insilmaril@37: <xsl:param name="filter"/> insilmaril@37: <xsl:param name="role"/> insilmaril@37: <xsl:param name="type"/> insilmaril@37: <xsl:param name="style" select="'default'" /> insilmaril@37: <xsl:param name="title"/> insilmaril@37: <xsl:param name="box"/> insilmaril@37: <xsl:param name="without"/> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:param name="againstID"/> insilmaril@37: <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href=$filter][member/topicRef/@xlink:href=concat('#',$currentID)]" /> insilmaril@37: <xsl:variable name="allThese" select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]" /> insilmaril@37: <xsl:variable name="w" select="substring-after($type, '#')" /> insilmaril@37: <xsl:variable name="all" select="$topics[starts-with(@id, concat($w, '-'))]" /> insilmaril@37: <xsl:variable name="found"> insilmaril@37: <xsl:for-each select="$all"> insilmaril@37: <xsl:variable name="this" select="@id" /> insilmaril@37: <xsl:variable name="c" select="count( $allThese[substring-after(@xlink:href, '#')=$this])" /> insilmaril@37: <xsl:if test="$c > 0"> insilmaril@37: <xsl:variable name="single" select="$this[1]" /> insilmaril@37: <a href="{$pre-link}{$single}{$post-link}" class="foundLink"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$single" /></xsl:call-template></a> insilmaril@37: </xsl:if> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:variable> insilmaril@37: <xsl:if test="string($found)"><xsl:copy-of select="$found" /></xsl:if> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="drawNextLevel"> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:param name="againstID"/> insilmaril@37: <xsl:param name="currentType"/> insilmaril@37: <xsl:param name="currentRole"/> insilmaril@37: <xsl:param name="style"/> insilmaril@37: <xsl:call-template name="getAllAssoc"> insilmaril@37: <xsl:with-param name="currentID" select="$currentID" /> insilmaril@37: <xsl:with-param name="againstID" select="$againstID" /> insilmaril@37: <xsl:with-param name="filter" select="'#group-subgroup'" /> insilmaril@37: <xsl:with-param name="role" select="$currentRole" /> insilmaril@37: <xsl:with-param name="box" select="'box'" /> insilmaril@37: <xsl:with-param name="style" select="$style" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="drawRelated"> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:param name="currentType"/> insilmaril@37: <xsl:param name="currentRole"/> insilmaril@37: <xsl:param name="style" select="'box'" /> insilmaril@37: <xsl:call-template name="getAll"> insilmaril@37: <xsl:with-param name="ThisThat" select="'#this'" /> insilmaril@37: <xsl:with-param name="role" select="$currentRole" /> insilmaril@37: <xsl:with-param name="box" select="$style" /> insilmaril@37: <xsl:with-param name="currentID" select="$currentID" /> insilmaril@37: </xsl:call-template> insilmaril@37: <xsl:call-template name="getAll"> insilmaril@37: <xsl:with-param name="ThisThat" select="'#that'" /> insilmaril@37: <xsl:with-param name="role" select="$currentRole" /> insilmaril@37: <xsl:with-param name="box" select="$style" /> insilmaril@37: <xsl:with-param name="currentID" select="$currentID" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getAll"> insilmaril@37: <xsl:param name="ThisThat"/> insilmaril@37: <xsl:param name="filter"/> insilmaril@37: <xsl:param name="title"/> insilmaril@37: <xsl:param name="role"/> insilmaril@37: <xsl:param name="box"/> insilmaril@37: <xsl:param name="without"/> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:variable name="allRelations" select="$topics[starts-with(@id, 'relation-')]" /> insilmaril@37: <xsl:variable name="allAssociations" select="$associations[member/topicRef/@xlink:href=concat('#',$currentID)]" /> insilmaril@37: <xsl:for-each select="$allRelations"> insilmaril@37: <xsl:variable name="relID" select="concat('#', @id)" /> insilmaril@37: <xsl:variable name="ThisThatRole"><xsl:choose><xsl:when test="$ThisThat = '#that'">#child</xsl:when><xsl:otherwise>#parent</xsl:otherwise></xsl:choose></xsl:variable> insilmaril@37: <xsl:variable name="thisName"><xsl:value-of select="baseName[scope/topicRef/@xlink:href=$ThisThat]/baseNameString" /></xsl:variable> insilmaril@37: <xsl:variable name="found"> insilmaril@37: <xsl:for-each select="$allAssociations"> insilmaril@37: <xsl:variable name="assocInstance" select="instanceOf/topicRef/@xlink:href" /> insilmaril@37: <xsl:variable name="assocHref" select="member[roleSpec/topicRef/@xlink:href=$ThisThatRole]/topicRef/@xlink:href" /> insilmaril@37: <xsl:variable name="thisID" select="substring-after($assocHref, '#')" /> insilmaril@37: <xsl:if test="$relID = $assocInstance and $thisID != $currentID"> insilmaril@37: <span class="{$box}Element"><a href="{$pre-link}{$thisID}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisID" /></xsl:call-template></a></span> insilmaril@37: </xsl:if> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:variable> insilmaril@37: <xsl:if test="string($found) and string($thisName)"> insilmaril@37: <xsl:call-template name="drawRelationsBox"> insilmaril@37: <xsl:with-param name="style" select="$box" /> insilmaril@37: <xsl:with-param name="title" select="$thisName" /> insilmaril@37: <xsl:with-param name="content" select="$found" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:if> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="getAllBlogs"> insilmaril@37: <xsl:param name="currentID"/> insilmaril@37: <xsl:param name="notraverse"/> insilmaril@37: insilmaril@37: <xsl:variable name="parentID"> insilmaril@37: <xsl:call-template name="getParent"> insilmaril@37: <xsl:with-param name="currentID" select="$currentID" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:variable> insilmaril@37: <xsl:choose> insilmaril@37: <xsl:when test="string($notraverse)"> insilmaril@37: <xsl:variable name="theseOnes" select="$topics[instanceOf/topicRef/@xlink:href='#blog']" /> insilmaril@37: <xsl:variable name="assoc" select="$associations[instanceOf/topicRef/@xlink:href='#group-subgroup'][member/topicRef/@xlink:href=concat('#',$currentID)]/member[roleSpec/topicRef/@xlink:href='#child']/topicRef" /> insilmaril@37: <div class="doc"> insilmaril@37: <xsl:for-each select="$theseOnes"> insilmaril@37: <xsl:variable name="ct" select="." /> insilmaril@37: <xsl:for-each select="$assoc"> insilmaril@37: <xsl:variable name="ca" select="." /> insilmaril@37: <xsl:variable name="t" select="substring-after($ca/@xlink:href, '#')" /> insilmaril@37: <xsl:if test="$t = $ct/@id"> insilmaril@37: <xsl:variable name="currentDate" select="$ct/occurrence[instanceOf/topicRef/@xlink:href='#blog-date']/resourceData" /> insilmaril@37: <div class="blogDate"><xsl:value-of select="$currentDate" /></div> insilmaril@37: <xsl:call-template name="displayBlogItem"> insilmaril@37: <xsl:with-param name="item" select="$ct" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:if> insilmaril@37: </xsl:for-each> insilmaril@37: </xsl:for-each> insilmaril@37: </div> insilmaril@37: </xsl:when> insilmaril@37: <xsl:otherwise> insilmaril@37: <xsl:variable name="items" select="$topics[instanceOf/topicRef/@xlink:href='#blog']" /> insilmaril@37: <xsl:call-template name="traverseBlog"> insilmaril@37: <xsl:with-param name="items" select="$items[position() < 6]" /> insilmaril@37: <xsl:with-param name="currentNo" select="'1'" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:otherwise> insilmaril@37: </xsl:choose> insilmaril@37: insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="traverseBlog"> insilmaril@37: <xsl:param name="items" /> insilmaril@37: <xsl:param name="currentNo" /> insilmaril@37: <xsl:param name="previousDate" /> insilmaril@37: insilmaril@37: <xsl:variable name="item" select="$items[position() = $currentNo]" /> insilmaril@37: insilmaril@37: <xsl:variable name="currentDate" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-date']/resourceData" /> insilmaril@37: insilmaril@37: <xsl:if test="string($currentDate)"> insilmaril@37: insilmaril@37: <xsl:if test="string($previousDate) = string($currentDate)"> insilmaril@37: <div class="blogEnd"> </div> insilmaril@37: </xsl:if> insilmaril@37: insilmaril@37: <xsl:if test="$previousDate != $currentDate"> insilmaril@37: <div class="blogDate"><xsl:value-of select="$currentDate" /></div> insilmaril@37: </xsl:if> insilmaril@37: insilmaril@37: <xsl:call-template name="displayBlogItem"> insilmaril@37: <xsl:with-param name="item" select="$item" /> insilmaril@37: </xsl:call-template> insilmaril@37: insilmaril@37: <xsl:if test="string($items[position() = $currentNo+1])"> insilmaril@37: <xsl:call-template name="traverseBlog"> insilmaril@37: <xsl:with-param name="items" select="$items" /> insilmaril@37: <xsl:with-param name="currentNo" select="$currentNo + 1" /> insilmaril@37: <xsl:with-param name="previousDate" select="$currentDate" /> insilmaril@37: </xsl:call-template> insilmaril@37: </xsl:if> insilmaril@37: insilmaril@37: </xsl:if> insilmaril@37: insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: <xsl:template name="displayBlogItem"> insilmaril@37: <xsl:param name="item" /> insilmaril@37: insilmaril@37: <xsl:variable name="currentHeader" select="$item/baseName/baseNameString" /> insilmaril@37: <xsl:variable name="currentDate" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-date']/resourceData" /> insilmaril@37: <xsl:variable name="currentLink" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-link']/resourceData" /> insilmaril@37: <xsl:variable name="currentShort" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-short']/resourceData" /> insilmaril@37: insilmaril@37: <div class="blogItem"> insilmaril@37: <xsl:if test="string($currentHeader)"><div class="blogHeader"><xsl:value-of select="$currentHeader" /></div></xsl:if> insilmaril@37: insilmaril@37: <xsl:variable name="fileName">../content/<xsl:value-of select="$item/@id" />.xml</xsl:variable> insilmaril@37: <xsl:variable name="this" select="document($fileName)/div/*" /> insilmaril@37: <xsl:apply-templates select="$this"><xsl:with-param name="currentID" select="$item/@id" /></xsl:apply-templates> insilmaril@37: insilmaril@37: <xsl:if test="string($currentLink)"><div class="blogLinkBox">Read the full story at < <a href="{$currentLink}"><xsl:value-of select="$currentHeader" /></a> ></div></xsl:if> insilmaril@37: insilmaril@37: <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href='#group-subgroup'][member/topicRef/@xlink:href=concat('#',$item/@id)]/member[roleSpec/topicRef/@xlink:href='#parent']" /> insilmaril@37: insilmaril@37: <span class="blogLinks"><a href="{$item/@id}.html" class="blogLink">Permalink</a>added <strong><xsl:value-of select="$currentDate" /></strong>.</span> insilmaril@37: insilmaril@37: <xsl:if test="count($theseOnes) > 0"> insilmaril@37: <span class="blogLinks"> insilmaril@37: Catalogued under: insilmaril@37: <xsl:for-each select="$theseOnes"> insilmaril@37: <xsl:variable name="chug" select="substring-after(topicRef/@xlink:href, '#')" /> insilmaril@37: <a href="{$pre-link}{$chug}{$post-link}" class="blogLink"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$chug" /></xsl:call-template> </a> insilmaril@37: </xsl:for-each> insilmaril@37: </span> insilmaril@37: </xsl:if> insilmaril@37: insilmaril@37: </div> insilmaril@37: insilmaril@37: </xsl:template> insilmaril@37: insilmaril@37: insilmaril@37: </xsl:stylesheet>