styles/mmap2vym.xsl
author insilmaril
Wed, 27 Feb 2008 16:09:06 +0000
changeset 671 367d875453ed
parent 221 733c1fd16b73
permissions -rw-r--r--
autosave fix
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 
     3 <!--
     4 	Document   : mmap2vym.xsl
     5 	Author     : Clemens Kraus (http://www.clemens-kraus.de)
     6 			     Uwe Drechsel <vym@InSilmaril.de>
     7 	
     8 	Description: transforms exported MindManager-files (version x5/6) into vym-format.
     9 	Bugs       : First Version, work still in progress!
    10 	Todo       : - xlinks still to be implemented
    11 	             - codes/symbols still to be implemented
    12 				 - Multimap links (.mmap) still to be implemented
    13 -->
    14 
    15 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    16 	xmlns:xlink="http://www.w3.org/1999/xlink"
    17 	xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
    18 	xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl math func"
    19 	xmlns:math="http://exslt.org/math"
    20 	xmlns:func="http://exslt.org/functions"
    21 	version="1.0">
    22 
    23 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    24 <xsl:param name="filenamep" />
    25 <xsl:variable name="filename" select="$filenamep"/>
    26 <!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>-->
    27 
    28 <!-- root element -->	
    29 <xsl:template match="/">
    30    	<xsl:element name="vymmap">
    31 		<!-- default settings: -->
    32 		<xsl:attribute name="comment">Converted from MindManager to vym
    33 		using mmap2vym.xsl</xsl:attribute>
    34 
    35 		<xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" />
    36 		<xsl:if test="$author">
    37 			<xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute>
    38 		</xsl:if>
    39 			
    40 		<xsl:element name="mapcenter">
    41 			<!-- recurse to map title node ... -->
    42 			<xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" />
    43 		</xsl:element>
    44 	</xsl:element>
    45 </xsl:template>
    46 
    47 <xsl:template match="ap:Topic/ap:Text">
    48 	<xsl:element name="heading">
    49 		<xsl:value-of select="@PlainText" />
    50 	</xsl:element>
    51 </xsl:template>
    52 
    53 
    54 <xsl:template match="ap:Topic">
    55 	<xsl:element name="branch">
    56 	<xsl:call-template name="position" />
    57 	<!-- =============================== hyperlink ================================ 
    58 	<xsl:variable name="url" select="ap:Hyperlink" />
    59 	<xsl:if test="$url">
    60 	<xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute>
    61 	</xsl:if>
    62 	<xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" />
    63 	<xsl:if test="contains($rect, 'Rectangle')">
    64 	<xsl:attribute name="frameType">Rectangle</xsl:attribute>
    65 	</xsl:if>
    66 	-->
    67 	<xsl:apply-templates/>
    68 	</xsl:element>
    69 </xsl:template>
    70 
    71 
    72 <!-- =============================== position ================================ -->
    73 <xsl:template name="position">
    74 	<xsl:if test="ap:Offset/@CX!=''">
    75 		<xsl:attribute name="relPosX">
    76 			<xsl:value-of select="ap:Offset/@CX *3"/>
    77 		</xsl:attribute>
    78 	</xsl:if>		
    79 	<xsl:if test="ap:Offset/@CY!=''">
    80 		<xsl:attribute name="relPosY">
    81 			<xsl:value-of select="floor( ap:Offset/@CY *3 )"/>
    82 		</xsl:attribute>
    83 	</xsl:if>		
    84 </xsl:template>
    85 
    86 	
    87 <!-- =============================== Icons ================================ -->
    88 <xsl:template match="ap:Icon">
    89 	<xsl:element name="standardFlag">
    90 		<xsl:choose>
    91 			<xsl:when test="@IconType ='urn:mindjet:ExclamationMark'">exclamationmark</xsl:when>
    92 			<xsl:when test="@IconType ='urn:mindjet:SmileyHappy'">smiley-good</xsl:when>
    93 			<xsl:when test="@IconType ='urn:mindjet:SmileySad'">smiley-sad</xsl:when>
    94 		<xsl:otherwise>
    95 			<xsl:message>Unknown Flag found: <xsl:value-of select="@IconType"/></xsl:message>
    96 		</xsl:otherwise>
    97 		</xsl:choose>
    98 	</xsl:element>
    99 </xsl:template>
   100 	
   101   
   102 </xsl:stylesheet>
   103 
   104