1 <?xml version="1.0" encoding="iso-8859-1"?>
4 Document : mmap2vym.xsl
8 Author : Clemens Kraus (http://www.clemens-kraus.de)
10 Description: transforms exported MindManager-files (version x5/6) into vym-format.
11 Bugs : First Version, work still in progress!
12 Todo : - xlinks still to be implemented
13 - codes/symbols still to be implemented
14 - Multimap links (.mmap) still to be implemented
17 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18 xmlns:xlink="http://www.w3.org/1999/xlink"
19 xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
20 xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl math func"
21 xmlns:math="http://exslt.org/math"
22 xmlns:func="http://exslt.org/functions"
25 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
26 <xsl:param name="filenamep" />
27 <xsl:variable name="filename" select="$filenamep"/>
28 <!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>-->
29 <xsl:variable name="maxxCoord"><xsl:value-of select="600" /></xsl:variable>
30 <xsl:variable name="maxyCoord"><xsl:value-of select="800" /></xsl:variable>
31 <xsl:variable name="minxCoord"><xsl:value-of select="0" /></xsl:variable>
32 <xsl:variable name="minyCoord"><xsl:value-of select="0" /></xsl:variable>
36 <xsl:template match="/">
38 <xsl:element name="vymmap">
39 <!-- default settings: -->
40 <xsl:attribute name="comment">Generated with mmap2vym (V0.1.2) - MindManager to vym converter. More infos: www.clemens-kraus.de</xsl:attribute>
41 <xsl:attribute name="backgroundColor">#ffffff</xsl:attribute>
42 <xsl:attribute name="linkStyle">StyleLine</xsl:attribute>
43 <xsl:attribute name="linkColor">#00007f</xsl:attribute>
44 <xsl:attribute name="linkColorHint">HeadingColor</xsl:attribute>
45 <xsl:attribute name="defXLinkColor">#e6e6e6</xsl:attribute>
46 <xsl:attribute name="defXLinkWidth">1</xsl:attribute>
48 <xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" />
49 <xsl:if test="$author">
50 <xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute>
53 <xsl:element name="mapcenter">
54 <!--xsl:attribute name="absPosX"><xsl:value-of select="300"/></xsl:attribute-->
55 <!--xsl:attribute name="absPosY"><xsl:value-of select="400"/></xsl:attribute-->
56 <!--xsl:attribute name="absPosX"><xsl:value-of select="- floor($minxCoord * 0.6) - 30"/></xsl:attribute-->
57 <!--xsl:attribute name="absPosY"><xsl:value-of select="floor($maxyCoord * 0.6)"/></xsl:attribute-->
58 <!-- xsl:message>absPos: <xsl:value-of select="-
59 floor($minxCoord * 0.6) - 30"/></xsl:message -->
61 <!-- recurse to map title node ... -->
62 <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:Text"/>
64 <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" />
71 <xsl:template match="ap:Topic/ap:Text">
72 <xsl:element name="heading">
73 <xsl:value-of select="@PlainText" />
78 <xsl:template match="ap:Topic">
80 <xsl:element name="branch">
81 <xsl:call-template name="position" />
83 <!-- =============================== hyperlink ================================ -->
84 <xsl:variable name="url" select="ap:Hyperlink" />
86 <xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute>
89 <xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" />
90 <xsl:if test="contains($rect, 'Rectangle')">
91 <xsl:attribute name="frameType">Rectangle</xsl:attribute>
92 <!--<xsl:message><xsl:text>Rectangle</xsl:text><xsl:value-of select="$rect"/></xsl:message>-->
95 <!-- =============================== closed ================================ -->
96 <!-- is branch closed? -->
97 <xsl:variable name="collapsed" select="ap:TopicViewGroup/Collapsed/@Collapsed" />
98 <xsl:if test="$collapsed = 'true'">
99 <xsl:attribute name="scrolled">
100 <xsl:value-of select="yes"/>
104 <xsl:element name="heading">
105 <xsl:if test="ap:Text/ap:Font/@Color">
106 <xsl:attribute name="textColor">
107 <xsl:value-of select="concat('#', substring(ap:Text/ap:Font/@Color, 3, 6))" />
110 <xsl:value-of select="ap:Text/@PlainText" />
112 <!-- <xsl:variable name="OId" select="@OId" />
113 <xsl:variable name="relation" select="/ap:Map/ap:Relationships/ap:Relationship[ap:ConnectionGroup[@Index=0]/ap:Connection/ap:ObjectReference/@OIdRef=$OId]" />
114 <xsl:if test="$relation">
115 <xsl:variable name="toId" select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" />
116 <xsl:element name="arrowlink">
117 <xsl:attribute name="ENDARROW">Default</xsl:attribute>
118 <xsl:attribute name="DESTINATION">
119 <xsl:value-of select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" />
121 <xsl:attribute name="STARTARROW">None</xsl:attribute>
124 <xsl:variable name="toId" select="/ap:Map/ap:Relationships/ap:Relationship/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference[@OIdRef=$OId]/@OIdRef" />
125 <xsl:if test="$toId">
126 <xsl:attribute name="ID">
127 <xsl:value-of select="$toId" />
133 <!-- =============================== createnote ================================ -->
134 <xsl:variable name="note" select="ap:NotesGroup" />
135 <xsl:if test="$note">
136 <xsl:element name="htmlnote">
137 <xsl:attribute name="fonthint">var</xsl:attribute>
138 <xsl:copy-of select="ap:NotesGroup/ap:NotesXhtmlData/*"/>
142 <xsl:apply-templates select="ap:SubTopics"/>
148 <!-- =============================== position ================================ -->
149 <!-- for position -->
150 <xsl:template name="position">
152 <xsl:attribute name="absPosX">
154 <xsl:value-of select="floor( (ap:Offset/@CX - $minxCoord) * 0.8 + 10 )"/>
155 <!--xsl:message>absPosX: <xsl:value-of select="floor( (ap:Offset/@CX - $minxCoord) * 0.8 + 10 )"/></xsl:message-->
157 <xsl:attribute name="absPosY">
158 <xsl:value-of select="floor( (- ap:Offset/@CY + $maxyCoord) * 0.6 + 10 )"/>
159 <!-- xsl:message>absPosY: <xsl:value-of select="floor( (- ap:Offset/@CY + $maxyCoord) * 0.6 + 10)"/></xsl:message-->
165 <!-- ========================== symbol (floatimage) =========================== -->
166 <!-- any floatimage? -->
167 <xsl:template match="symbol">
169 <xsl:if test="string-length(./url) > 0">
170 <xsl:variable name="imagename" >
171 <xsl:call-template name="getfn" >
172 <xsl:with-param name="txt" select="substring-before( translate( normalize-space( current() ), '\', '/' ), '.' )" />
176 <xsl:element name="floatimage">
177 <xsl:attribute name="relPosX">
178 <xsl:value-of select="'20'"/>
180 <xsl:attribute name="relPosY">
181 <xsl:value-of select="'-50'"/>
183 <xsl:attribute name="useOrientation">
184 <xsl:text>true</xsl:text>
186 <xsl:attribute name="saveInMap">
187 <xsl:text>true</xsl:text>
190 <xsl:attribute name="href">
191 <xsl:value-of select="concat('file:', $filename, '-image-', $imagename, '.png')"/>
199 <!-- =============================== hyperlink ================================ -->
200 <xsl:template match="xhyperLink">
203 <xsl:when test="substring(., 1, 4)='http'">
204 <xsl:attribute name="url">
205 <xsl:value-of select="."/>
209 <xsl:when test="contains(., '.mmp')">
210 <xsl:attribute name="vymLink">
211 <!-- Aus .mmp .vym machen und '\' durch '/' ersetzen -->
212 <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/>
217 <!-- <xsl:message terminate="yes">Test: <xsl:value-of select="."/></xsl:message> -->
218 <xsl:attribute name="url">
219 <xsl:value-of select="concat( 'file:/', translate(current(), '\', '/') )"/>
225 <!-- <xsl:if test="substring(., 1, 4)='http'">
226 <xsl:attribute name="url">
227 <xsl:value-of select="."/>
231 <xsl:if test="contains(., '.mmp')">
232 <xsl:attribute name="vymLink">
233 <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/>
240 <!-- ================================= getfn ================================== -->
241 <!-- get the filename (without the path) -->
243 <xsl:template name="getfn">
244 <xsl:param name="txt" select="." />
247 <xsl:when test="contains($txt, '/')" >
248 <xsl:variable name="right" select="substring-after($txt, '/')" />
249 <xsl:if test="string-length($right)>1" >
250 <xsl:call-template name="getfn" >
251 <xsl:with-param name="txt" select="$right" />
256 <xsl:value-of select="$txt" />
263 <!-- =============================== codes ================================ -->
264 <xsl:template match="codes">
266 <!-- file:/home/clemens/CLEMENS/MM/Tools/Open Interface Reference Guide/doc/enum-mmcode.html -->
267 <xsl:element name="standardFlag">
269 <xsl:when test="code = '1'">lamp</xsl:when>
270 <xsl:when test="code = '2'">arrow-up</xsl:when>
271 <xsl:when test="code = '3'">arrow-down</xsl:when>
272 <!-- <xsl:when test="code = ">scrolled-right</xsl:when> -->
273 <xsl:when test="code = '5'">hook-green</xsl:when>
274 <xsl:when test="code = '6'">questionmark</xsl:when>
275 <xsl:when test="code = '7'">smiley-good</xsl:when>
276 <xsl:when test="code = '8'">smiley-sad</xsl:when>
277 <xsl:when test="code = '11'">stopsign</xsl:when>
278 <xsl:when test="code = '13'">clock</xsl:when>
279 <xsl:when test="code = '15'">clock</xsl:when>
280 <xsl:when test="code = '17'">cross-red</xsl:when>
281 <xsl:when test="code = '41'">cross-red</xsl:when>
282 <xsl:when test="code = '20'">exclamationmark</xsl:when>
283 <xsl:when test="code = '29'">thumb-up</xsl:when>
284 <!-- <xsl:when test="code = '9'">note</xsl:when>
285 <xsl:when test="code = '32'">note</xsl:when> -->
286 <xsl:otherwise>heart</xsl:otherwise>
288 <!-- Fuer spaetere Erweiterung um eigene Codes: z.B. MindManager-Codes "code-9.png"
289 <xsl:value-of select="concat( 'code-', current() )"/> -->
295 <!-- =============================== color ================================ -->
296 <xsl:template match="color">
297 <xsl:attribute name="textColor">
298 <!-- switch from BBGGRR to #RRGGBB representation -->
299 <xsl:text>#</xsl:text>
300 <xsl:value-of select="substring( ., 5, 2 )"/>
301 <xsl:value-of select="substring( ., 3, 2 )"/>
302 <xsl:value-of select="substring( ., 1, 2 )"/>
307 <!-- =============================== for future use ================================ -->
308 <xsl:template match="Name">
309 <xsl:attribute name="NAME">
310 <xsl:value-of select="."/>
314 <xsl:template match="Size">
315 <xsl:attribute name="SIZE">
316 <xsl:value-of select="."/>
320 <xsl:template match="Bold">
321 <xsl:attribute name="BOLD">
322 <xsl:value-of select="."/>
326 <xsl:template match="Italic">
327 <xsl:attribute name="ITALIC">
328 <xsl:value-of select="."/>
332 <xsl:template match="Underline">
333 <xsl:attribute name="UNDERLINE">
334 <xsl:value-of select="."/>
338 <xsl:template match="Strikethrough">
339 <xsl:attribute name="Strikethrough">
340 <xsl:value-of select="."/>
344 <!-- template extracting a subset of font attributes -->
345 <xsl:template match="ap:font">
346 <xsl:apply-templates select="@Name"/>
347 <xsl:apply-templates select="@Size"/>
348 <xsl:apply-templates select="@Bold"/>
349 <xsl:apply-templates select="@Italic"/>
350 <xsl:apply-templates select="@Underline"/>
351 <xsl:apply-templates select="@Strikethrough"/>