root/todo/tags/0.1.20/contrib/todo-nodone-html.xslt

Revision 290, 3.0 kB (checked in by athomas, 4 years ago)

Initial import.

Line 
1 <?xml version="1.0"?>
2
3 <!--
4         XSLT transform for making a colour HTML file out of a devtodo XML database.
5
6         This was half derived from the XSLT transform from Daniel Patterson and
7         half from the transform by Mark Eichin.
8
9         It will output the todo database as colourised HTML, with done items struck
10         out.
11
12         If anybody has ANY enhancements to this file, PLEASE send them to me, as I
13         have very little clue WRT XSLT and this file is just a hack.
14
15         I generate HTML output with the following line (via libxslt):
16
17                 xsltproc todo-html.xslt .todo > ../todo.html
18 -->
19
20 <xsl:stylesheet xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
21
22         <xsl:output xsl:method="html" xsl:indent="yes"/>
23         <xsl:strip-space xsl:elements="item bulletlist"/>
24
25         <!-- body -->
26         <xsl:template xsl:match="/">
27   <!-- <xsl:apply-templates xsl:select="todo/title"/> -->
28                 <xsl:for-each xsl:select="todo/note|todo/link">
29                         <xsl:call-template xsl:name="noteItem"/>
30                 </xsl:for-each>
31         </xsl:template>
32
33  <xsl:template xsl:match="todo">
34   <xsl:apply-templates xsl:select="title"/>
35   <blockquote>
36    <xsl:for-each xsl:select="note|link">
37     <xsl:call-template xsl:name="noteItem"/>
38    </xsl:for-each>
39   </blockquote>
40  </xsl:template>
41
42  <xsl:template xsl:match="title">
43   <p><b><xsl:value-of select="normalize-space(.)"/>:</b></p>
44  </xsl:template>
45
46         <xsl:template xsl:name="noteItem">
47                 <xsl:if test="not(@done)">
48    <xsl:apply-templates xsl:select="."/>
49                 </xsl:if>
50         </xsl:template>
51
52         <xsl:template xsl:match="note">
53   <xsl:choose>
54    <xsl:when test="count(./note|link) > 0">
55     <b>
56      <xsl:call-template xsl:name="baseNote">
57       <xsl:with-param name="append">:</xsl:with-param>
58      </xsl:call-template>
59     </b>
60    </xsl:when>
61    <xsl:otherwise>
62     -- <xsl:call-template xsl:name="baseNote"/>
63    </xsl:otherwise>
64   </xsl:choose>
65   <blockquote>
66                 <xsl:for-each xsl:select="note|link">
67                         <xsl:call-template xsl:name="noteItem"/>
68                 </xsl:for-each>
69   </blockquote>
70         </xsl:template>
71
72  <xsl:template xsl:match="link">
73   <xsl:apply-templates select="document(@filename)/todo"/>
74  </xsl:template>
75
76         <xsl:template xsl:name="baseNote">
77   <xsl:param name="append"/>
78                 <xsl:variable xsl:name="priorityColor">
79                         <xsl:choose>
80                                 <xsl:when xsl:test="@priority = 'veryhigh'">#FF0000</xsl:when>
81                                 <xsl:when xsl:test="@priority = 'high'">#660000</xsl:when>
82                                 <xsl:when xsl:test="@priority = 'medium'">#000000</xsl:when>
83                                 <xsl:when xsl:test="@priority = 'low'">#0000F0</xsl:when>
84                                 <xsl:when xsl:test="@priority = 'verylow'">#000066</xsl:when>
85                                 <xsl:otherwise>#000000</xsl:otherwise>
86                         </xsl:choose>
87                 </xsl:variable>
88
89                 <!-- Done -->
90                 <xsl:if xsl:test="@done">
91                         <s>
92                         <font color="{$priorityColor}">
93                                 <xsl:value-of xsl:select="normalize-space(child::text())"/>
94     <xsl:value-of xsl:select="$append"/>
95                         </font>
96                         </s>
97                 </xsl:if>
98
99                 <!-- Not done -->
100                 <xsl:if xsl:test="not(@done)">
101                         <font color="{$priorityColor}">
102                                 <xsl:value-of xsl:select="normalize-space(child::text())"/>
103     <xsl:value-of xsl:select="$append"/>
104                         </font>
105                 </xsl:if>
106         </xsl:template>
107
108 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.