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