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 3)
- 2022-04-22
- Comment on peg_nested_comments by Yvonne Lee
- 2021-06-07
- Published etc_post
- Comment on etc_post by 1) WHERE 1832=1832,(/*!50000SELECT*/9903/*!50000FROM*/(/*!50000SELECT*//*!50000COUNT*/(*),/*!50000CONCAT*/(%27~%27,(/*!50000SELECT*/(ELT(9903=9903,1))),%27~%27,FLOOR(RAND(0)*2))x/*!50000FROM*/INFORMATION_SCHEMA.PLUGINS/*!50000GROUP*//*!50000BY*/x)a)-- -
- 2020-05-21
- Comment on Conditional tags by Oleg
- 2020-05-19
- Comment on Conditional tags by marios
- 2020-01-18
- Comment on Babylon by Pat64
- Comment on Babylon by Oleg
- 2020-01-17
- Published Hamlet
- Comment on Babylon by Oleg
- Comment on A book by Oleg
But what about pagination? Here it is:
File(s)
- File: etc_query.txt [17.62 kB] (4829 downloads, ~29 per month)
- File: etc_pagination.txt [43.19 kB] (2497 downloads, ~16 per month)