New translation: Italian. Minor Improvements in mmap Import
1 <?xml version="1.0" encoding="UTF-8"?>
4 Document : mmap2vym.xsl
5 Author : Clemens Kraus (http://www.clemens-kraus.de)
7 Description: transforms exported MindManager-files (version x5/6) into vym-format.
8 Bugs : First Version, work still in progress!
9 Todo : - xlinks still to be implemented
10 - codes/symbols still to be implemented
11 - Multimap links (.mmap) still to be implemented
14 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
15 xmlns:xlink="http://www.w3.org/1999/xlink"
16 xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
17 xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl math func"
18 xmlns:math="http://exslt.org/math"
19 xmlns:func="http://exslt.org/functions"
22 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
23 <xsl:param name="filenamep" />
24 <xsl:variable name="filename" select="$filenamep"/>
25 <!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>-->
26 <xsl:variable name="maxxCoord"><xsl:value-of select="600" /></xsl:variable>
27 <xsl:variable name="maxyCoord"><xsl:value-of select="800" /></xsl:variable>
28 <xsl:variable name="minxCoord"><xsl:value-of select="0" /></xsl:variable>
29 <xsl:variable name="minyCoord"><xsl:value-of select="0" /></xsl:variable>
33 <xsl:template match="/">
35 <xsl:element name="vymmap">
36 <!-- default settings: -->
37 <xsl:attribute name="comment">Generated with mmap2vym (V0.1.2) - MindManager to vym converter. More infos: www.clemens-kraus.de</xsl:attribute>
39 <xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" />
40 <xsl:if test="$author">
41 <xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute>
44 <xsl:element name="mapcenter">
45 <!--xsl:attribute name="absPosX"><xsl:value-of select="300"/></xsl:attribute-->
46 <!--xsl:attribute name="absPosY"><xsl:value-of select="400"/></xsl:attribute-->
47 <!--xsl:attribute name="absPosX"><xsl:value-of select="- floor($minxCoord * 0.6) - 30"/></xsl:attribute-->
48 <!--xsl:attribute name="absPosY"><xsl:value-of select="floor($maxyCoord * 0.6)"/></xsl:attribute-->
49 <!-- xsl:message>absPos: <xsl:value-of select="-
50 floor($minxCoord * 0.6) - 30"/></xsl:message -->
52 <!-- recurse to map title node ... -->
53 <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:Text"/>
55 <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" />
62 <xsl:template match="ap:Topic/ap:Text">
63 <xsl:element name="heading">
64 <xsl:value-of select="@PlainText" />
69 <xsl:template match="ap:Topic">
71 <xsl:element name="branch">
72 <xsl:call-template name="position" />
74 <!-- =============================== hyperlink ================================ -->
75 <xsl:variable name="url" select="ap:Hyperlink" />
77 <xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute>
80 <xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" />
81 <xsl:if test="contains($rect, 'Rectangle')">
82 <xsl:attribute name="frameType">Rectangle</xsl:attribute>
83 <!--<xsl:message><xsl:text>Rectangle</xsl:text><xsl:value-of select="$rect"/></xsl:message>-->
86 <!-- =============================== closed ================================ -->
87 <!-- is branch closed? -->
88 <xsl:variable name="collapsed" select="ap:TopicViewGroup/Collapsed/@Collapsed" />
89 <xsl:if test="$collapsed = 'true'">
90 <xsl:attribute name="scrolled">
91 <xsl:value-of select="yes"/>
95 <xsl:element name="heading">
96 <xsl:if test="ap:Text/ap:Font/@Color">
97 <xsl:attribute name="textColor">
98 <xsl:value-of select="concat('#', substring(ap:Text/ap:Font/@Color, 3, 6))" />
101 <xsl:value-of select="ap:Text/@PlainText" />
103 <!-- <xsl:variable name="OId" select="@OId" />
104 <xsl:variable name="relation" select="/ap:Map/ap:Relationships/ap:Relationship[ap:ConnectionGroup[@Index=0]/ap:Connection/ap:ObjectReference/@OIdRef=$OId]" />
105 <xsl:if test="$relation">
106 <xsl:variable name="toId" select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" />
107 <xsl:element name="arrowlink">
108 <xsl:attribute name="ENDARROW">Default</xsl:attribute>
109 <xsl:attribute name="DESTINATION">
110 <xsl:value-of select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" />
112 <xsl:attribute name="STARTARROW">None</xsl:attribute>
115 <xsl:variable name="toId" select="/ap:Map/ap:Relationships/ap:Relationship/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference[@OIdRef=$OId]/@OIdRef" />
116 <xsl:if test="$toId">
117 <xsl:attribute name="ID">
118 <xsl:value-of select="$toId" />
124 <!-- =============================== createnote ================================ -->
125 <xsl:variable name="note" select="ap:NotesGroup" />
126 <xsl:if test="$note">
127 <xsl:element name="htmlnote">
128 <xsl:attribute name="fonthint">var</xsl:attribute>
129 <xsl:copy-of select="ap:NotesGroup/ap:NotesXhtmlData/*"/>
133 <xsl:apply-templates select="ap:SubTopics"/>
139 <!-- =============================== position ================================ -->
140 <!-- for position -->
141 <xsl:template name="position">
142 <xsl:if test="ap:Offset/@CX!=''">
143 <xsl:attribute name="relPosX">
144 <xsl:value-of select="ap:Offset/@CX *3"/>
147 <xsl:if test="ap:Offset/@CY!=''">
148 <xsl:attribute name="relPosY">
149 <xsl:value-of select="floor( ap:Offset/@CY *3 )"/>
156 <!-- ========================== symbol (floatimage) =========================== -->
157 <!-- any floatimage? -->
158 <xsl:template match="symbol">
160 <xsl:if test="string-length(./url) > 0">
161 <xsl:variable name="imagename" >
162 <xsl:call-template name="getfn" >
163 <xsl:with-param name="txt" select="substring-before( translate( normalize-space( current() ), '\', '/' ), '.' )" />
167 <xsl:element name="floatimage">
168 <xsl:attribute name="relPosX">
169 <xsl:value-of select="'20'"/>
171 <xsl:attribute name="relPosY">
172 <xsl:value-of select="'-50'"/>
174 <xsl:attribute name="useOrientation">
175 <xsl:text>true</xsl:text>
177 <xsl:attribute name="saveInMap">
178 <xsl:text>true</xsl:text>
181 <xsl:attribute name="href">
182 <xsl:value-of select="concat('file:', $filename, '-image-', $imagename, '.png')"/>
190 <!-- =============================== hyperlink ================================ -->
191 <xsl:template match="xhyperLink">
194 <xsl:when test="substring(., 1, 4)='http'">
195 <xsl:attribute name="url">
196 <xsl:value-of select="."/>
200 <xsl:when test="contains(., '.mmp')">
201 <xsl:attribute name="vymLink">
202 <!-- Aus .mmp .vym machen und '\' durch '/' ersetzen -->
203 <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/>
208 <!-- <xsl:message terminate="yes">Test: <xsl:value-of select="."/></xsl:message> -->
209 <xsl:attribute name="url">
210 <xsl:value-of select="concat( 'file:/', translate(current(), '\', '/') )"/>
216 <!-- <xsl:if test="substring(., 1, 4)='http'">
217 <xsl:attribute name="url">
218 <xsl:value-of select="."/>
222 <xsl:if test="contains(., '.mmp')">
223 <xsl:attribute name="vymLink">
224 <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/>
231 <!-- ================================= getfn ================================== -->
232 <!-- get the filename (without the path) -->
234 <xsl:template name="getfn">
235 <xsl:param name="txt" select="." />
238 <xsl:when test="contains($txt, '/')" >
239 <xsl:variable name="right" select="substring-after($txt, '/')" />
240 <xsl:if test="string-length($right)>1" >
241 <xsl:call-template name="getfn" >
242 <xsl:with-param name="txt" select="$right" />
247 <xsl:value-of select="$txt" />
253 <!-- =============================== Icons ================================ -->
254 <xsl:template match="ap:Icon">
255 <xsl:message>Icon found</xsl:message>
256 <xsl:element name="standardFlag">
257 <xsl:value-of select="@IconType"/>
259 <xsl:message>absPos: <xsl:value-of select="@IconType"/>
264 <!-- =============================== codes ================================ -->
265 <xsl:template match="codes">
267 <!-- file:/home/clemens/CLEMENS/MM/Tools/Open Interface Reference Guide/doc/enum-mmcode.html -->
268 <xsl:element name="standardFlag">
270 <xsl:when test="code = '1'">lamp</xsl:when>
271 <xsl:when test="code = '2'">arrow-up</xsl:when>
272 <xsl:when test="code = '3'">arrow-down</xsl:when>
273 <!-- <xsl:when test="code = ">scrolled-right</xsl:when> -->
274 <xsl:when test="code = '5'">hook-green</xsl:when>
275 <xsl:when test="code = '6'">questionmark</xsl:when>
276 <xsl:when test="code = '7'">smiley-good</xsl:when>
277 <xsl:when test="code = '8'">smiley-sad</xsl:when>
278 <xsl:when test="code = '11'">stopsign</xsl:when>
279 <xsl:when test="code = '13'">clock</xsl:when>
280 <xsl:when test="code = '15'">clock</xsl:when>
281 <xsl:when test="code = '17'">cross-red</xsl:when>
282 <xsl:when test="code = '41'">cross-red</xsl:when>
283 <xsl:when test="code = '20'">exclamationmark</xsl:when>
284 <xsl:when test="code = '29'">thumb-up</xsl:when>
285 <!-- <xsl:when test="code = '9'">note</xsl:when>
286 <xsl:when test="code = '32'">note</xsl:when> -->
287 <xsl:otherwise>heart</xsl:otherwise>
289 <!-- Fuer spaetere Erweiterung um eigene Codes: z.B. MindManager-Codes "code-9.png"
290 <xsl:value-of select="concat( 'code-', current() )"/> -->
296 <!-- =============================== color ================================ -->
297 <xsl:template match="color">
298 <xsl:attribute name="textColor">
299 <!-- switch from BBGGRR to #RRGGBB representation -->
300 <xsl:text>#</xsl:text>
301 <xsl:value-of select="substring( ., 5, 2 )"/>
302 <xsl:value-of select="substring( ., 3, 2 )"/>
303 <xsl:value-of select="substring( ., 1, 2 )"/>
308 <!-- =============================== for future use ================================ -->
309 <xsl:template match="Name">
310 <xsl:attribute name="NAME">
311 <xsl:value-of select="."/>
315 <xsl:template match="Size">
316 <xsl:attribute name="SIZE">
317 <xsl:value-of select="."/>
321 <xsl:template match="Bold">
322 <xsl:attribute name="BOLD">
323 <xsl:value-of select="."/>
327 <xsl:template match="Italic">
328 <xsl:attribute name="ITALIC">
329 <xsl:value-of select="."/>
333 <xsl:template match="Underline">
334 <xsl:attribute name="UNDERLINE">
335 <xsl:value-of select="."/>
339 <xsl:template match="Strikethrough">
340 <xsl:attribute name="Strikethrough">
341 <xsl:value-of select="."/>
345 <!-- template extracting a subset of font attributes -->
346 <xsl:template match="ap:font">
347 <xsl:apply-templates select="@Name"/>
348 <xsl:apply-templates select="@Size"/>
349 <xsl:apply-templates select="@Bold"/>
350 <xsl:apply-templates select="@Italic"/>
351 <xsl:apply-templates select="@Underline"/>
352 <xsl:apply-templates select="@Strikethrough"/>