-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathiki-sort.xsl
36 lines (31 loc) · 1.36 KB
/
iki-sort.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<xsl:stylesheet
xmlns="http://www.mediawiki.org/xml/export-0.3/"
xmlns:mw="http://www.mediawiki.org/xml/export-0.3/"
exclude-result-prefixes="mw"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="mw:mediawiki">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select="substring(mw:timestamp,1,4)"/>
<xsl:sort select="substring(mw:timestamp,6,2)"/>
<xsl:sort select="substring(mw:timestamp,9,2)"/>
<xsl:sort select="substring(mw:timestamp,12,2)"/>
<xsl:sort select="substring(mw:timestamp,15,2)"/>
<xsl:sort select="substring(mw:timestamp,18,2)"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<!-- uncomment this to make sure the dates are being sorted correctly
<xsl:template match="mw:revision">
<xsl:value-of select="mw:id"/>: <xsl:value-of select="substring(mw:timestamp,1,4)"/> - <xsl:value-of select="substring(mw:timestamp,6,2)"/> - <xsl:value-of select="substring(mw:timestamp,9,2)"/> T <xsl:value-of select="substring(mw:timestamp,12,2)"/> : <xsl:value-of select="substring(mw:timestamp,15,2)"/> : <xsl:value-of select="substring(mw:timestamp,18,2)"/>
<xsl:text>
</xsl:text>
</xsl:template>
-->
<xsl:template match="*|@*|text()">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>