insilmaril@218: <?xml version="1.0" encoding="UTF-8"?>
insilmaril@217: 
insilmaril@217: <!--
insilmaril@217: 	Document   : mmap2vym.xsl
insilmaril@217: 	Author     : Clemens Kraus (http://www.clemens-kraus.de)
insilmaril@219: 			     Uwe Drechsel <vym@InSilmaril.de>
insilmaril@217: 	
insilmaril@217: 	Description: transforms exported MindManager-files (version x5/6) into vym-format.
insilmaril@217: 	Bugs       : First Version, work still in progress!
insilmaril@217: 	Todo       : - xlinks still to be implemented
insilmaril@217: 	             - codes/symbols still to be implemented
insilmaril@219: 				 - Multimap links (.mmap) still to be implemented
insilmaril@217: -->
insilmaril@217: 
insilmaril@217: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
insilmaril@217: 	xmlns:xlink="http://www.w3.org/1999/xlink"
insilmaril@219: 	xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
insilmaril@217: 	xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl math func"
insilmaril@217: 	xmlns:math="http://exslt.org/math"
insilmaril@217: 	xmlns:func="http://exslt.org/functions"
insilmaril@217: 	version="1.0">
insilmaril@217: 
insilmaril@217: <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
insilmaril@219: <xsl:param name="filenamep" />
insilmaril@219: <xsl:variable name="filename" select="$filenamep"/>
insilmaril@219: <!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>-->
insilmaril@217: 
insilmaril@219: <!-- root element -->	
insilmaril@219: <xsl:template match="/">
insilmaril@219:    	<xsl:element name="vymmap">
insilmaril@219: 		<!-- default settings: -->
insilmaril@221: 		<xsl:attribute name="comment">Converted from MindManager to vym
insilmaril@221: 		using mmap2vym.xsl</xsl:attribute>
insilmaril@217: 
insilmaril@219: 		<xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" />
insilmaril@219: 		<xsl:if test="$author">
insilmaril@219: 			<xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute>
insilmaril@219: 		</xsl:if>
insilmaril@219: 			
insilmaril@219: 		<xsl:element name="mapcenter">
insilmaril@219: 			<!-- recurse to map title node ... -->
insilmaril@219: 			<xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" />
insilmaril@219: 		</xsl:element>
insilmaril@219: 	</xsl:element>
insilmaril@219: </xsl:template>
insilmaril@217: 
insilmaril@219: <xsl:template match="ap:Topic/ap:Text">
insilmaril@219: 	<xsl:element name="heading">
insilmaril@219: 		<xsl:value-of select="@PlainText" />
insilmaril@219: 	</xsl:element>
insilmaril@219: </xsl:template>
insilmaril@217: 
insilmaril@217: 
insilmaril@219: <xsl:template match="ap:Topic">
insilmaril@219: 	<xsl:element name="branch">
insilmaril@219: 	<xsl:call-template name="position" />
insilmaril@221: 	<!-- =============================== hyperlink ================================ 
insilmaril@219: 	<xsl:variable name="url" select="ap:Hyperlink" />
insilmaril@219: 	<xsl:if test="$url">
insilmaril@219: 	<xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute>
insilmaril@219: 	</xsl:if>
insilmaril@219: 	<xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" />
insilmaril@219: 	<xsl:if test="contains($rect, 'Rectangle')">
insilmaril@219: 	<xsl:attribute name="frameType">Rectangle</xsl:attribute>
insilmaril@219: 	</xsl:if>
insilmaril@221: 	-->
insilmaril@219: 	<xsl:apply-templates/>
insilmaril@219: 	</xsl:element>
insilmaril@219: </xsl:template>
insilmaril@217: 
insilmaril@217: 
insilmaril@219: <!-- =============================== position ================================ -->
insilmaril@219: <xsl:template name="position">
insilmaril@218: 	<xsl:if test="ap:Offset/@CX!=''">
insilmaril@218: 		<xsl:attribute name="relPosX">
insilmaril@219: 			<xsl:value-of select="ap:Offset/@CX *3"/>
insilmaril@218: 		</xsl:attribute>
insilmaril@218: 	</xsl:if>		
insilmaril@218: 	<xsl:if test="ap:Offset/@CY!=''">
insilmaril@218: 		<xsl:attribute name="relPosY">
insilmaril@218: 			<xsl:value-of select="floor( ap:Offset/@CY *3 )"/>
insilmaril@218: 		</xsl:attribute>
insilmaril@218: 	</xsl:if>		
insilmaril@219: </xsl:template>
insilmaril@217: 
insilmaril@217: 	
insilmaril@218: <!-- =============================== Icons ================================ -->
insilmaril@218: <xsl:template match="ap:Icon">
insilmaril@218: 	<xsl:element name="standardFlag">
insilmaril@219: 		<xsl:choose>
insilmaril@219: 			<xsl:when test="@IconType ='urn:mindjet:ExclamationMark'">exclamationmark</xsl:when>
insilmaril@219: 			<xsl:when test="@IconType ='urn:mindjet:SmileyHappy'">smiley-good</xsl:when>
insilmaril@219: 			<xsl:when test="@IconType ='urn:mindjet:SmileySad'">smiley-sad</xsl:when>
insilmaril@219: 		<xsl:otherwise>
insilmaril@219: 			<xsl:message>Unknown Flag found: <xsl:value-of select="@IconType"/></xsl:message>
insilmaril@219: 		</xsl:otherwise>
insilmaril@219: 		</xsl:choose>
insilmaril@218: 	</xsl:element>
insilmaril@218: </xsl:template>
insilmaril@218: 	
insilmaril@217:   
insilmaril@217: </xsl:stylesheet>
insilmaril@217: 
insilmaril@217: