Starting with version 1.2, etc_query
supports XSL stylesheets. An immediate benefice is the possibility to sort an XML document. In the example below we mix and rearrange by date <txp:article_custom />
and <txp:recent_comments />
lists:
<txp:etc_query
data='<dl>
<txp:article_custom>
<dt><txp:posted format="%Y-%m-%d" /></dt>
<dd>Published <txp:permlink><txp:title /></txp:permlink></dd>
</txp:article_custom>
<txp:recent_comments break="">
<dt><txp:comment_time format="%Y-%m-%d" /></dt>
<dd>Comment on <txp:comment_permlink><txp:title /></txp:comment_permlink> by <txp:comment_name /></dd>
</txp:recent_comments>
</dl>'
>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:txp="https://www.textpattern.com">
<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" />
<xsl:template match="dl">
<h4>History</h4>
<dl>
<xsl:for-each select="dt">
<xsl:sort select="." order="descending" />
<xsl:if test="position() < 11">
<txp:if_different><xsl:copy-of select="." /></txp:if_different>
<xsl:copy-of select="following-sibling::dd[1]" />
</xsl:if>
</xsl:for-each>
</dl>
</xsl:template>
</xsl:stylesheet>
</txp:etc_query>
History (page 7)
- 2017-03-15
- Comment on etc_pagination by Alicson
- 2016-10-23
- Published Similar articles list
- 2016-06-15
- Comment on etc_tree by Bashir
- Comment on etc_tree by Oleg
- 2016-04-28
- Comment on etc_tree by Bashir
- Comment on etc_tree by Oleg
- Comment on etc_tree by Oleg
- 2016-04-07
- Comment on Mixed glossary index by Destry
- Comment on Mixed glossary index by Oleg
- 2016-04-05
- Published Mixed glossary index
But what about pagination? Here it is:
File(s)
- File: etc_query.txt [60.72 kB] (4255 downloads, ~29 per month)
- File: etc_pagination.txt [43.19 kB] (1977 downloads, ~14 per month)