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