aboutsummaryrefslogtreecommitdiff
path: root/source/99_result
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-06 19:53:32 +0200
committerAdrian Kummerlaender2014-09-06 19:53:32 +0200
commit58731af0158c107a5d0c96d48224b97c28b0f4b5 (patch)
tree17081930041973ddb4322bc3e9915c21fc8bc7d0 /source/99_result
parent5ab0f971e767f190aceea48cc6aab6a2bfa42bea (diff)
downloadblog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.tar
blog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.tar.gz
blog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.tar.bz2
blog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.tar.lz
blog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.tar.xz
blog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.tar.zst
blog.kummerlaender.eu-58731af0158c107a5d0c96d48224b97c28b0f4b5.zip
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.xsl50
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() &lt;= $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() &lt; $boundary">
- <xsl:copy-of select="."/>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:variable name="lower_half" select="xalan:nodeset($sorted_pages)/page[position() &lt;= $boundary]"/>
- <xsl:variable name="upper_half" select="xalan:nodeset($sorted_pages)/page[position() &gt; $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>