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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
<?xml version="1.0"?>
<!--
todo2xhtml_css - convert a devtodo database to a CSS+XHTML page
Version: 0.9
Copyright (c) 2004-2005 Francesco Poli, <frx@firenze.linux.it>
Copyright (c) 2005 Arthur Korn, <arthur@korn.ch>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
As a special exception, when parts of this file are copied by the XSLT
transformation into an output file, you may use that output file without
restriction.
-->
<!--
Suggested usage:
a) put todo2xhtml_css.xslt and todo.css in /usr/local/share/devtodo/
b) put something like the following in your ~/.todorc
# When saving a database, also create an XHTML+CSS version as .todo.html.
# This requires the libxslt library from xmlsoft.org in addition to the
# XSLT and CSS files in the devtodo contrib directory.
on save {
echo XHTML+CSS created
exec if test ! -e $HOME/.todo.css ; then cp /usr/local/share/devtodo/todo.css $HOME/.todo.css ; fi
exec if test ! -e `dirname $TODODB`/.todo.css ; then cp $HOME/.todo.css `dirname $TODODB`/.todo.css ; fi
exec xsltproc /usr/local/share/devtodo/todo2xhtml_css.xslt $TODODB > `dirname $TODODB`/.todo.html
exec chmod 600 `dirname $TODODB`/.todo.html
}
Rationale:
The XSLT transformation generates an XHTML page representing the todo
list; this XHTML page refers to an external CSS stylesheet to be
found in the same directory.
The XHTML page will be updated after every todolist database change.
A user-specific CSS stylesheet will be copied from the system-wide
default one, *only* if it is not already in the user's home directory.
The CSS stylesheet in the current directory will be copied from the
user-specific one, *only* if it is not already there.
The user can customize (or even completely replace) his/her ~/.todo.css
of even some local ./.todo.css : they will not be touched at all, as
long as they are present with the right filename.
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsl:text disable-output-escaping = "yes"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
</xsl:text>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Todo list</title>
<style type="text/css">
<xsl:text disable-output-escaping = "yes">
/*<![CDATA[*/
@import "./.todo.css";
/*]]>*/
</xsl:text>
</style>
<script type="text/javascript">
<xsl:text disable-output-escaping = "yes">
//<![CDATA[
<!--
function updateDisplay(tag, tag_class, new_display)
{
var tags = document.getElementsByTagName(tag);
for (var i=0; i<tags.length; i++)
{
var thing = tags[i];
if (thing.className == tag_class)
{
thing.style.display = new_display;
}
}
}
//-->
//]]>
</xsl:text>
</script>
</head>
<body onload="updateDisplay('a', 'visibility', 'inline')">
<div id="outercontainer">
<div id="innercontainer">
<div id="outertitle">
<div id="innertitle">
<h1>Todo list</h1>
</div>
</div>
<div id="outerlegend">
<div id="innerlegend">
<ol>
<li class="veryhigh"><a class="visibility"
href="#" title="show done items"
onclick="updateDisplay('li', 'veryhighdone', 'list-item')">s</a>
<a class="visibility" href="#" title="hide done items"
onclick="updateDisplay('li', 'veryhighdone', 'none')">h</a>
veryhigh</li>
<li class="high"><a class="visibility"
href="#" title="show done items"
onclick="updateDisplay('li', 'highdone', 'list-item')">s</a>
<a class="visibility" href="#" title="hide done items"
onclick="updateDisplay('li', 'highdone', 'none')">h</a>
high</li>
<li class="medium"><a class="visibility"
href="#" title="show done items"
onclick="updateDisplay('li', 'mediumdone', 'list-item')">s</a>
<a class="visibility" href="#" title="hide done items"
onclick="updateDisplay('li', 'mediumdone', 'none')">h</a>
medium</li>
<li class="low"><a class="visibility"
href="#" title="show done items"
onclick="updateDisplay('li', 'lowdone', 'list-item')">s</a>
<a class="visibility" href="#" title="hide done items"
onclick="updateDisplay('li', 'lowdone', 'none')">h</a>
low</li>
<li class="verylow"><a class="visibility"
href="#" title="show done items"
onclick="updateDisplay('li', 'verylowdone', 'list-item')">s</a>
<a class="visibility" href="#" title="hide done items"
onclick="updateDisplay('li', 'verylowdone', 'none')">h</a>
verylow</li>
</ol>
<ol>
<li class="veryhighdone">done veryhigh</li>
<li class="highdone">done high</li>
<li class="mediumdone">done medium</li>
<li class="lowdone">done low</li>
<li class="verylowdone">done verylow</li>
</ol>
</div>
</div>
<div id="outerlist">
<div id="innerlist">
<xsl:apply-templates />
</div>
</div>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="/todo">
<xsl:call-template name="list_of_notes" />
</xsl:template>
<xsl:template name="list_of_notes">
<ol>
<xsl:for-each select="./note">
<xsl:apply-templates select="." />
</xsl:for-each>
</ol>
</xsl:template>
<xsl:template match="note">
<xsl:element name="li">
<xsl:attribute name="class">
<xsl:value-of select="@priority" />
<xsl:if test="@done">done</xsl:if>
</xsl:attribute>
<xsl:value-of select="child::text()" />
<xsl:if test="./note">
<xsl:call-template name="list_of_notes" />
</xsl:if>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
|