source: freemind/trunk/fuentes/freemind/accessories/mm2tsk.xsl @ 68

Last change on this file since 68 was 68, checked in by jrpelegrina, 4 years ago

First release to Xenial

File size: 3.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3         
4Document   : mm2tsk.xsl
5Created on : 02 October 2010 - 22:14
6Author     : Giacomo Lacava toyg@users at sourceforge.net
7Description: transforms freemind mm format to tsk, used by TaskCoach.
8
9Note: this doesn't handle richtext nodes yet
10
11* This program is free software; you can redistribute it and/or
12* modify it under the terms of the GNU General Public License
13* as published by the Free Software Foundation; either version 2
14* of the License, or any later version.
15*
16* This program is distributed in the hope that it will be useful,
17* but WITHOUT ANY WARRANTY; without even the implied warranty of
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19* GNU General Public License for more details.
20*
21* You should have received a copy of the GNU General Public License
22* along with this program; if not, write to the Free Software
23* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24
25Patches item #3080120, was opened at 2010-10-02 21:34
26https://sourceforge.net/tracker/?func=detail&atid=307118&aid=3080120&group_id=7118
27Summary: Export to TaskCoach
28
29Initial Comment:
30The attached XSL will convert a MM file to TSK, the format used by TaskCoach ( http://www.taskcoach.org ), a popular todo manager (FOSS).
31
32At the moment it doesn't export richtext nodes properly  -- surely you already have a good way to "flatten" them, but I can't find it. TaskCoach doesn't handle HTML, afaik.
33
34TSK files require a date-time value in the "startdate" attribute of tasks; it has to be set in the past for nodes to be seen as "active". I don't know if your XSL parser handles XSLT 2.0 (many don't), so I used a 1.0 extension available online in order to do that -- I add the current timestamp, and since more than a second will always pass between the file being saved and the export being opened in TaskCoach, it seems to work.
35
36Let me know if you need anything else.
37   
38-->
39<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
40        xmlns:datetime="http://exslt.org/dates-and-times" exclude-result-prefixes="datetime"> 
41
42        <xsl:param name="datestr" select="datetime:dateTime()" />
43        <xsl:param name="date">
44                <xsl:value-of select="substring($datestr,0,5)" />
45                <xsl:text>-</xsl:text>
46                <xsl:value-of select="substring($datestr,6,2)" />
47                <xsl:text>-</xsl:text>
48                <xsl:value-of select="substring($datestr,9,2)" />
49                <xsl:text> </xsl:text>
50                <xsl:value-of select="substring($datestr,12,2)" />
51                <xsl:text>:</xsl:text>
52                <xsl:value-of select="substring($datestr,15,2)" />
53                <xsl:text>:</xsl:text>
54                <xsl:value-of select="substring($datestr,18,2)" />
55        </xsl:param>
56
57        <xsl:template match="/">
58                <xsl:processing-instruction name="taskcoach">release="1.1.4" tskversion="30"</xsl:processing-instruction>
59                <tasks>
60                        <xsl:apply-templates />
61                </tasks>
62        </xsl:template>
63
64        <xsl:template match="node">
65                <task>
66                        <xsl:attribute name="startdate">
67                                <xsl:value-of select="$date"/> 
68                        </xsl:attribute>
69                        <xsl:attribute name="status">1</xsl:attribute>
70                        <xsl:attribute name="subject">
71                                <xsl:value-of select="@TEXT"/>
72                        </xsl:attribute>
73                        <xsl:apply-templates />
74                </task>
75        </xsl:template>
76
77</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.