diff options
Removed unnecessarily complex category sorting logic
* it was primarily implemented this way to complement the CSS layout of the page
* after trying different approaches it turned out that plain sorting by digest size gives the best results for the contents of my personal page
Diffstat (limited to 'source/99_result')
-rw-r--r-- | source/99_result/category/category.xsl | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/source/99_result/category/category.xsl b/source/99_result/category/category.xsl index ce6cb1d..eb53cc6 100644 --- a/source/99_result/category/category.xsl +++ b/source/99_result/category/category.xsl @@ -18,15 +18,13 @@ <xsl:value-of select="/datasource/category/entry/@handle"/> </xsl:template> -<xsl:template name="page_entry"> - <xsl:param name="source"/> - +<xsl:template match="entry/page"> <li> <em>ยป</em> - <a href="{$url}/page/{$source/@handle}"> - <strong><xsl:value-of select="$source/title"/></strong> + <a href="{$url}/page/{@handle}"> + <strong><xsl:value-of select="title"/></strong> <p> - <xsl:copy-of select="$source/digest/node()"/> + <xsl:copy-of select="digest/node()"/> </p> </a> </li> @@ -40,43 +38,9 @@ </h3> <div class="archiv columns"> <ul class="prettylist"> - <xsl:variable name="ceiling" select="count(page) + 1"/> - <xsl:variable name="boundary" select="$ceiling div 2"/> - - <xsl:variable name="sorted_pages"> - <xsl:for-each select="page"> - <xsl:sort select="digest/@size" data-type="number" order="descending"/> - - <xsl:if test="position() <= $boundary"> - <xsl:copy-of select="."/> - </xsl:if> - </xsl:for-each> - - <xsl:for-each select="page"> - <xsl:sort select="digest/@size" data-type="number" order="ascending"/> - - <xsl:if test="position() < $boundary"> - <xsl:copy-of select="."/> - </xsl:if> - </xsl:for-each> - </xsl:variable> - - <xsl:variable name="lower_half" select="xalan:nodeset($sorted_pages)/page[position() <= $boundary]"/> - <xsl:variable name="upper_half" select="xalan:nodeset($sorted_pages)/page[position() > $boundary]"/> - - <xsl:for-each select="$lower_half"> - <xsl:variable name="index" select="position()"/> - - <xsl:call-template name="page_entry"> - <xsl:with-param name="source" select="."/> - </xsl:call-template> - - <xsl:if test="$upper_half[$index]"> - <xsl:call-template name="page_entry"> - <xsl:with-param name="source" select="$upper_half[$index]"/> - </xsl:call-template> - </xsl:if> - </xsl:for-each> + <xsl:apply-templates select="page"> + <xsl:sort select="digest/@size" data-type="number" order="descending"/> + </xsl:apply-templates> </ul> </div> </xsl:template> |