summaryrefslogtreecommitdiff
path: root/xslt
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2011-05-23 12:33:07 -0400
committerShaun McCance <shaunm@gnome.org>2011-05-23 12:33:07 -0400
commitad1cf2b7bbd40b84f6ad8179d5995001b0666d27 (patch)
tree54917f6983af6ff768edda482864e61adbceeb2f /xslt
parent12b20239fff364777538129ac11d08f2a05c9ad1 (diff)
downloadyelp-tools-ad1cf2b7bbd40b84f6ad8179d5995001b0666d27.tar.gz
yelp-check: Added --totals to yelp-check status
Diffstat (limited to 'xslt')
-rw-r--r--xslt/mal-status.xsl42
1 files changed, 39 insertions, 3 deletions
diff --git a/xslt/mal-status.xsl b/xslt/mal-status.xsl
index 11bf31d..3e95dba 100644
--- a/xslt/mal-status.xsl
+++ b/xslt/mal-status.xsl
@@ -3,6 +3,7 @@
xmlns:mal="http://projectmallard.org/1.0/"
xmlns:cache="http://projectmallard.org/cache/1.0/"
xmlns:exsl="http://exslt.org/common"
+ xmlns:str="http://exslt.org/strings"
xmlns:dyn="http://exslt.org/dynamic"
exclude-result-prefixes="mal cache exsl dyn"
version="1.0">
@@ -21,6 +22,32 @@
<xsl:param name="except" select="''"/>
<xsl:variable name="except_" select="concat(' ', $except, ' ')"/>
+<xsl:param name="totals" select="''"/>
+
+<xsl:template match="/">
+ <xsl:choose>
+ <xsl:when test="$totals = '1'">
+ <xsl:variable name="statuses">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:variable name="stlist" select="str:split($statuses)"/>
+ <xsl:for-each select="$stlist">
+ <xsl:sort select="string(.)"/>
+ <xsl:variable name="stval" select="string(.)"/>
+ <xsl:if test="not(preceding-sibling::*[string(.) = $stval])">
+ <xsl:value-of select="$stval"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="count($stlist[string(.) = $stval])"/>
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="/cache:cache">
<xsl:for-each select="mal:page">
<xsl:sort select="@id"/>
@@ -67,10 +94,19 @@
(translate($revision/@date, '-', '') &lt; translate($older, '-', '')))">
<xsl:if test="$newer = '' or ($revision/@date and
(translate($revision/@date, '-', '') &gt; translate($newer, '-', '')))">
- <xsl:value-of select="@id"/>
- <xsl:text>: </xsl:text>
+ <xsl:if test="$totals != '1'">
+ <xsl:value-of select="@id"/>
+ <xsl:text>: </xsl:text>
+ </xsl:if>
<xsl:value-of select="$status"/>
- <xsl:text>&#x000A;</xsl:text>
+ <xsl:choose>
+ <xsl:when test="$totals != '1'">
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
</xsl:if>
</xsl:if>