1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/styles/mmap2vym.xsl Tue Feb 21 16:18:23 2006 +0000
1.3 @@ -0,0 +1,356 @@
1.4 +<?xml version="1.0" encoding="iso-8859-1"?>
1.5 +
1.6 +<!--
1.7 + Document : mmap2vym.xsl
1.8 + Created on : 20051120
1.9 + Modified : 20051128
1.10 + Version : 0.1.2
1.11 + Author : Clemens Kraus (http://www.clemens-kraus.de)
1.12 +
1.13 + Description: transforms exported MindManager-files (version x5/6) into vym-format.
1.14 + Bugs : First Version, work still in progress!
1.15 + Todo : - xlinks still to be implemented
1.16 + - codes/symbols still to be implemented
1.17 + - Multimap links (.mmap) still to be implemented
1.18 +-->
1.19 +
1.20 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.21 + xmlns:xlink="http://www.w3.org/1999/xlink"
1.22 + xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
1.23 + xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl math func"
1.24 + xmlns:math="http://exslt.org/math"
1.25 + xmlns:func="http://exslt.org/functions"
1.26 + version="1.0">
1.27 +
1.28 +<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
1.29 + <xsl:param name="filenamep" />
1.30 + <xsl:variable name="filename" select="$filenamep"/>
1.31 + <!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>-->
1.32 + <xsl:variable name="maxxCoord"><xsl:value-of select="600" /></xsl:variable>
1.33 + <xsl:variable name="maxyCoord"><xsl:value-of select="800" /></xsl:variable>
1.34 + <xsl:variable name="minxCoord"><xsl:value-of select="0" /></xsl:variable>
1.35 + <xsl:variable name="minyCoord"><xsl:value-of select="0" /></xsl:variable>
1.36 +
1.37 +
1.38 + <!-- root element -->
1.39 + <xsl:template match="/">
1.40 +
1.41 + <xsl:element name="vymmap">
1.42 + <!-- default settings: -->
1.43 + <xsl:attribute name="comment">Generated with mmap2vym (V0.1.2) - MindManager to vym converter. More infos: www.clemens-kraus.de</xsl:attribute>
1.44 + <xsl:attribute name="backgroundColor">#ffffff</xsl:attribute>
1.45 + <xsl:attribute name="linkStyle">StyleLine</xsl:attribute>
1.46 + <xsl:attribute name="linkColor">#00007f</xsl:attribute>
1.47 + <xsl:attribute name="linkColorHint">HeadingColor</xsl:attribute>
1.48 + <xsl:attribute name="defXLinkColor">#e6e6e6</xsl:attribute>
1.49 + <xsl:attribute name="defXLinkWidth">1</xsl:attribute>
1.50 +
1.51 + <xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" />
1.52 + <xsl:if test="$author">
1.53 + <xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute>
1.54 + </xsl:if>
1.55 +
1.56 + <xsl:element name="mapcenter">
1.57 + <!--xsl:attribute name="absPosX"><xsl:value-of select="300"/></xsl:attribute-->
1.58 + <!--xsl:attribute name="absPosY"><xsl:value-of select="400"/></xsl:attribute-->
1.59 + <!--xsl:attribute name="absPosX"><xsl:value-of select="- floor($minxCoord * 0.6) - 30"/></xsl:attribute-->
1.60 + <!--xsl:attribute name="absPosY"><xsl:value-of select="floor($maxyCoord * 0.6)"/></xsl:attribute-->
1.61 + <!-- xsl:message>absPos: <xsl:value-of select="-
1.62 + floor($minxCoord * 0.6) - 30"/></xsl:message -->
1.63 +
1.64 + <!-- recurse to map title node ... -->
1.65 + <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:Text"/>
1.66 +
1.67 + <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" />
1.68 +
1.69 + </xsl:element>
1.70 +
1.71 + </xsl:element>
1.72 + </xsl:template>
1.73 +
1.74 + <xsl:template match="ap:Topic/ap:Text">
1.75 + <xsl:element name="heading">
1.76 + <xsl:value-of select="@PlainText" />
1.77 + </xsl:element>
1.78 + </xsl:template>
1.79 +
1.80 +
1.81 + <xsl:template match="ap:Topic">
1.82 +
1.83 + <xsl:element name="branch">
1.84 + <xsl:call-template name="position" />
1.85 +
1.86 + <!-- =============================== hyperlink ================================ -->
1.87 + <xsl:variable name="url" select="ap:Hyperlink" />
1.88 + <xsl:if test="$url">
1.89 + <xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute>
1.90 + </xsl:if>
1.91 +
1.92 + <xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" />
1.93 + <xsl:if test="contains($rect, 'Rectangle')">
1.94 + <xsl:attribute name="frameType">Rectangle</xsl:attribute>
1.95 + <!--<xsl:message><xsl:text>Rectangle</xsl:text><xsl:value-of select="$rect"/></xsl:message>-->
1.96 + </xsl:if>
1.97 +
1.98 + <!-- =============================== closed ================================ -->
1.99 + <!-- is branch closed? -->
1.100 + <xsl:variable name="collapsed" select="ap:TopicViewGroup/Collapsed/@Collapsed" />
1.101 + <xsl:if test="$collapsed = 'true'">
1.102 + <xsl:attribute name="scrolled">
1.103 + <xsl:value-of select="yes"/>
1.104 + </xsl:attribute>
1.105 + </xsl:if>
1.106 +
1.107 + <xsl:element name="heading">
1.108 + <xsl:if test="ap:Text/ap:Font/@Color">
1.109 + <xsl:attribute name="textColor">
1.110 + <xsl:value-of select="concat('#', substring(ap:Text/ap:Font/@Color, 3, 6))" />
1.111 + </xsl:attribute>
1.112 + </xsl:if>
1.113 + <xsl:value-of select="ap:Text/@PlainText" />
1.114 +
1.115 + <!-- <xsl:variable name="OId" select="@OId" />
1.116 + <xsl:variable name="relation" select="/ap:Map/ap:Relationships/ap:Relationship[ap:ConnectionGroup[@Index=0]/ap:Connection/ap:ObjectReference/@OIdRef=$OId]" />
1.117 + <xsl:if test="$relation">
1.118 + <xsl:variable name="toId" select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" />
1.119 + <xsl:element name="arrowlink">
1.120 + <xsl:attribute name="ENDARROW">Default</xsl:attribute>
1.121 + <xsl:attribute name="DESTINATION">
1.122 + <xsl:value-of select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" />
1.123 + </xsl:attribute>
1.124 + <xsl:attribute name="STARTARROW">None</xsl:attribute>
1.125 + </xsl:element>
1.126 + </xsl:if>
1.127 + <xsl:variable name="toId" select="/ap:Map/ap:Relationships/ap:Relationship/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference[@OIdRef=$OId]/@OIdRef" />
1.128 + <xsl:if test="$toId">
1.129 + <xsl:attribute name="ID">
1.130 + <xsl:value-of select="$toId" />
1.131 + </xsl:attribute>
1.132 + </xsl:if> -->
1.133 +
1.134 + </xsl:element>
1.135 +
1.136 + <!-- =============================== createnote ================================ -->
1.137 + <xsl:variable name="note" select="ap:NotesGroup" />
1.138 + <xsl:if test="$note">
1.139 + <xsl:element name="htmlnote">
1.140 + <xsl:attribute name="fonthint">var</xsl:attribute>
1.141 + <xsl:copy-of select="ap:NotesGroup/ap:NotesXhtmlData/*"/>
1.142 + </xsl:element>
1.143 + </xsl:if>
1.144 +
1.145 + <xsl:apply-templates select="ap:SubTopics"/>
1.146 + </xsl:element>
1.147 +
1.148 + </xsl:template>
1.149 +
1.150 +
1.151 + <!-- =============================== position ================================ -->
1.152 + <!-- for position -->
1.153 + <xsl:template name="position">
1.154 +
1.155 + <xsl:attribute name="absPosX">
1.156 + <!-- if CX != "" -->
1.157 + <xsl:value-of select="floor( (ap:Offset/@CX - $minxCoord) * 0.8 + 10 )"/>
1.158 + <!--xsl:message>absPosX: <xsl:value-of select="floor( (ap:Offset/@CX - $minxCoord) * 0.8 + 10 )"/></xsl:message-->
1.159 + </xsl:attribute>
1.160 + <xsl:attribute name="absPosY">
1.161 + <xsl:value-of select="floor( (- ap:Offset/@CY + $maxyCoord) * 0.6 + 10 )"/>
1.162 + <!-- xsl:message>absPosY: <xsl:value-of select="floor( (- ap:Offset/@CY + $maxyCoord) * 0.6 + 10)"/></xsl:message-->
1.163 + </xsl:attribute>
1.164 +
1.165 + </xsl:template>
1.166 +
1.167 +
1.168 + <!-- ========================== symbol (floatimage) =========================== -->
1.169 + <!-- any floatimage? -->
1.170 + <xsl:template match="symbol">
1.171 +
1.172 + <xsl:if test="string-length(./url) > 0">
1.173 + <xsl:variable name="imagename" >
1.174 + <xsl:call-template name="getfn" >
1.175 + <xsl:with-param name="txt" select="substring-before( translate( normalize-space( current() ), '\', '/' ), '.' )" />
1.176 + </xsl:call-template>
1.177 + </xsl:variable>
1.178 +
1.179 + <xsl:element name="floatimage">
1.180 + <xsl:attribute name="relPosX">
1.181 + <xsl:value-of select="'20'"/>
1.182 + </xsl:attribute>
1.183 + <xsl:attribute name="relPosY">
1.184 + <xsl:value-of select="'-50'"/>
1.185 + </xsl:attribute>
1.186 + <xsl:attribute name="useOrientation">
1.187 + <xsl:text>true</xsl:text>
1.188 + </xsl:attribute>
1.189 + <xsl:attribute name="saveInMap">
1.190 + <xsl:text>true</xsl:text>
1.191 + </xsl:attribute>
1.192 +
1.193 + <xsl:attribute name="href">
1.194 + <xsl:value-of select="concat('file:', $filename, '-image-', $imagename, '.png')"/>
1.195 + </xsl:attribute>
1.196 + </xsl:element>
1.197 + </xsl:if>
1.198 +
1.199 + </xsl:template>
1.200 +
1.201 +
1.202 + <!-- =============================== hyperlink ================================ -->
1.203 + <xsl:template match="xhyperLink">
1.204 +
1.205 + <xsl:choose>
1.206 + <xsl:when test="substring(., 1, 4)='http'">
1.207 + <xsl:attribute name="url">
1.208 + <xsl:value-of select="."/>
1.209 + </xsl:attribute>
1.210 + </xsl:when>
1.211 +
1.212 + <xsl:when test="contains(., '.mmp')">
1.213 + <xsl:attribute name="vymLink">
1.214 + <!-- Aus .mmp .vym machen und '\' durch '/' ersetzen -->
1.215 + <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/>
1.216 + </xsl:attribute>
1.217 + </xsl:when>
1.218 +
1.219 + <xsl:otherwise>
1.220 + <!-- <xsl:message terminate="yes">Test: <xsl:value-of select="."/></xsl:message> -->
1.221 + <xsl:attribute name="url">
1.222 + <xsl:value-of select="concat( 'file:/', translate(current(), '\', '/') )"/>
1.223 + </xsl:attribute>
1.224 + </xsl:otherwise>
1.225 + </xsl:choose>
1.226 +
1.227 +
1.228 +<!-- <xsl:if test="substring(., 1, 4)='http'">
1.229 + <xsl:attribute name="url">
1.230 + <xsl:value-of select="."/>
1.231 + </xsl:attribute>
1.232 + </xsl:if>
1.233 +
1.234 + <xsl:if test="contains(., '.mmp')">
1.235 + <xsl:attribute name="vymLink">
1.236 + <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/>
1.237 + </xsl:attribute>
1.238 + </xsl:if> -->
1.239 +
1.240 + </xsl:template>
1.241 +
1.242 +
1.243 + <!-- ================================= getfn ================================== -->
1.244 + <!-- get the filename (without the path) -->
1.245 +
1.246 + <xsl:template name="getfn">
1.247 + <xsl:param name="txt" select="." />
1.248 +
1.249 + <xsl:choose>
1.250 + <xsl:when test="contains($txt, '/')" >
1.251 + <xsl:variable name="right" select="substring-after($txt, '/')" />
1.252 + <xsl:if test="string-length($right)>1" >
1.253 + <xsl:call-template name="getfn" >
1.254 + <xsl:with-param name="txt" select="$right" />
1.255 + </xsl:call-template>
1.256 + </xsl:if>
1.257 + </xsl:when>
1.258 + <xsl:otherwise>
1.259 + <xsl:value-of select="$txt" />
1.260 + </xsl:otherwise>
1.261 + </xsl:choose>
1.262 +
1.263 + </xsl:template>
1.264 +
1.265 +
1.266 + <!-- =============================== codes ================================ -->
1.267 + <xsl:template match="codes">
1.268 +
1.269 + <!-- file:/home/clemens/CLEMENS/MM/Tools/Open Interface Reference Guide/doc/enum-mmcode.html -->
1.270 + <xsl:element name="standardFlag">
1.271 + <xsl:choose>
1.272 + <xsl:when test="code = '1'">lamp</xsl:when>
1.273 + <xsl:when test="code = '2'">arrow-up</xsl:when>
1.274 + <xsl:when test="code = '3'">arrow-down</xsl:when>
1.275 + <!-- <xsl:when test="code = ">scrolled-right</xsl:when> -->
1.276 + <xsl:when test="code = '5'">hook-green</xsl:when>
1.277 + <xsl:when test="code = '6'">questionmark</xsl:when>
1.278 + <xsl:when test="code = '7'">smiley-good</xsl:when>
1.279 + <xsl:when test="code = '8'">smiley-sad</xsl:when>
1.280 + <xsl:when test="code = '11'">stopsign</xsl:when>
1.281 + <xsl:when test="code = '13'">clock</xsl:when>
1.282 + <xsl:when test="code = '15'">clock</xsl:when>
1.283 + <xsl:when test="code = '17'">cross-red</xsl:when>
1.284 + <xsl:when test="code = '41'">cross-red</xsl:when>
1.285 + <xsl:when test="code = '20'">exclamationmark</xsl:when>
1.286 + <xsl:when test="code = '29'">thumb-up</xsl:when>
1.287 + <!-- <xsl:when test="code = '9'">note</xsl:when>
1.288 + <xsl:when test="code = '32'">note</xsl:when> -->
1.289 + <xsl:otherwise>heart</xsl:otherwise>
1.290 + </xsl:choose>
1.291 + <!-- Fuer spaetere Erweiterung um eigene Codes: z.B. MindManager-Codes "code-9.png"
1.292 + <xsl:value-of select="concat( 'code-', current() )"/> -->
1.293 + </xsl:element>
1.294 +
1.295 + </xsl:template>
1.296 +
1.297 +
1.298 + <!-- =============================== color ================================ -->
1.299 + <xsl:template match="color">
1.300 + <xsl:attribute name="textColor">
1.301 + <!-- switch from BBGGRR to #RRGGBB representation -->
1.302 + <xsl:text>#</xsl:text>
1.303 + <xsl:value-of select="substring( ., 5, 2 )"/>
1.304 + <xsl:value-of select="substring( ., 3, 2 )"/>
1.305 + <xsl:value-of select="substring( ., 1, 2 )"/>
1.306 + </xsl:attribute>
1.307 + </xsl:template>
1.308 +
1.309 +
1.310 + <!-- =============================== for future use ================================ -->
1.311 + <xsl:template match="Name">
1.312 + <xsl:attribute name="NAME">
1.313 + <xsl:value-of select="."/>
1.314 + </xsl:attribute>
1.315 + </xsl:template>
1.316 +
1.317 + <xsl:template match="Size">
1.318 + <xsl:attribute name="SIZE">
1.319 + <xsl:value-of select="."/>
1.320 + </xsl:attribute>
1.321 + </xsl:template>
1.322 +
1.323 + <xsl:template match="Bold">
1.324 + <xsl:attribute name="BOLD">
1.325 + <xsl:value-of select="."/>
1.326 + </xsl:attribute>
1.327 + </xsl:template>
1.328 +
1.329 + <xsl:template match="Italic">
1.330 + <xsl:attribute name="ITALIC">
1.331 + <xsl:value-of select="."/>
1.332 + </xsl:attribute>
1.333 + </xsl:template>
1.334 +
1.335 + <xsl:template match="Underline">
1.336 + <xsl:attribute name="UNDERLINE">
1.337 + <xsl:value-of select="."/>
1.338 + </xsl:attribute>
1.339 + </xsl:template>
1.340 +
1.341 + <xsl:template match="Strikethrough">
1.342 + <xsl:attribute name="Strikethrough">
1.343 + <xsl:value-of select="."/>
1.344 + </xsl:attribute>
1.345 + </xsl:template>
1.346 +
1.347 + <!-- template extracting a subset of font attributes -->
1.348 + <xsl:template match="ap:font">
1.349 + <xsl:apply-templates select="@Name"/>
1.350 + <xsl:apply-templates select="@Size"/>
1.351 + <xsl:apply-templates select="@Bold"/>
1.352 + <xsl:apply-templates select="@Italic"/>
1.353 + <xsl:apply-templates select="@Underline"/>
1.354 + <xsl:apply-templates select="@Strikethrough"/>
1.355 + </xsl:template>
1.356 +
1.357 +</xsl:stylesheet>
1.358 +
1.359 +