summaryrefslogtreecommitdiff
path: root/xslt
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2011-05-23 12:15:16 -0400
committerShaun McCance <shaunm@gnome.org>2011-05-23 12:15:16 -0400
commit12b20239fff364777538129ac11d08f2a05c9ad1 (patch)
treeaa166105c726c7ae2633da913bf4f414ff4ea836 /xslt
parentc6a5f8d46bf08983f730e2c8efd37be05d9a78e5 (diff)
downloadyelp-tools-12b20239fff364777538129ac11d08f2a05c9ad1.tar.gz
yelp-check: Mallard page status checker
Diffstat (limited to 'xslt')
-rw-r--r--xslt/Makefile.am1
-rw-r--r--xslt/mal-status.xsl81
2 files changed, 82 insertions, 0 deletions
diff --git a/xslt/Makefile.am b/xslt/Makefile.am
index de4eee2..4d4aa7c 100644
--- a/xslt/Makefile.am
+++ b/xslt/Makefile.am
@@ -4,6 +4,7 @@ xsl_DATA = \
mal-epub.xsl \
mal-opf.xsl \
mal-ncx.xsl \
+ mal-status.xsl \
mal-rng.xsl
EXTRA_DIST = \
diff --git a/xslt/mal-status.xsl b/xslt/mal-status.xsl
new file mode 100644
index 0000000..11bf31d
--- /dev/null
+++ b/xslt/mal-status.xsl
@@ -0,0 +1,81 @@
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:mal="http://projectmallard.org/1.0/"
+ xmlns:cache="http://projectmallard.org/cache/1.0/"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:dyn="http://exslt.org/dynamic"
+ exclude-result-prefixes="mal cache exsl dyn"
+ version="1.0">
+
+<xsl:output method="text"/>
+
+<xsl:param name="version" select="''"/>
+<xsl:param name="docversion" select="''"/>
+<xsl:param name="pkgversion" select="''"/>
+
+<xsl:param name="older" select="''"/>
+<xsl:param name="newer" select="''"/>
+
+<xsl:param name="only" select="''"/>
+<xsl:variable name="only_" select="concat(' ', $only, ' ')"/>
+<xsl:param name="except" select="''"/>
+<xsl:variable name="except_" select="concat(' ', $except, ' ')"/>
+
+<xsl:template match="/cache:cache">
+ <xsl:for-each select="mal:page">
+ <xsl:sort select="@id"/>
+ <xsl:variable name="select">
+ <xsl:text>mal:info/mal:revision</xsl:text>
+ <xsl:if test="$version != ''">
+ <xsl:text>[@version = '</xsl:text>
+ <xsl:value-of select="$version"/>
+ <xsl:text>']</xsl:text>
+ </xsl:if>
+ <xsl:if test="$docversion != ''">
+ <xsl:text>[@docversion = '</xsl:text>
+ <xsl:value-of select="$docversion"/>
+ <xsl:text>']</xsl:text>
+ </xsl:if>
+ <xsl:if test="$version != ''">
+ <xsl:text>[@pkgversion = '</xsl:text>
+ <xsl:value-of select="$pkgversion"/>
+ <xsl:text>']</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="revision_">
+ <xsl:for-each select="dyn:evaluate($select)">
+ <xsl:sort select="@date" order="descending"/>
+ <xsl:if test="position() = 1">
+ <xsl:copy-of select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="revision" select="exsl:node-set($revision_)/*"/>
+ <xsl:variable name="status">
+ <xsl:choose>
+ <xsl:when test="$revision and $revision/@status">
+ <xsl:value-of select="$revision/@status"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>none</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$only = '' or contains($only_, concat(' ', $status, ' '))">
+ <xsl:if test="$except = '' or not(contains($except_, concat(' ', $status, ' ')))">
+ <xsl:if test="$older = '' or ($revision/@date and
+ (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:value-of select="$status"/>
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>