# HG changeset patch # User insilmaril # Date 1140712756 0 # Node ID a860efcaac4cafae5d7e1dca647a8d8a4e8d63e1 # Parent 160459d924a1015a24c1c023cf9227cec4a6bdcd Cleaned up mmap import a bit. Started to convert flags there, too diff -r 160459d924a1 -r a860efcaac4c styles/mmap2vym.xsl --- a/styles/mmap2vym.xsl Thu Feb 23 08:37:39 2006 +0000 +++ b/styles/mmap2vym.xsl Thu Feb 23 16:39:16 2006 +0000 @@ -3,145 +3,77 @@ <!-- Document : mmap2vym.xsl Author : Clemens Kraus (http://www.clemens-kraus.de) + Uwe Drechsel <vym@InSilmaril.de> Description: transforms exported MindManager-files (version x5/6) into vym-format. Bugs : First Version, work still in progress! Todo : - xlinks still to be implemented - codes/symbols still to be implemented - - Multimap links (.mmap) still to be implemented + - Multimap links (.mmap) still to be implemented --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003" + xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl math func" xmlns:math="http://exslt.org/math" xmlns:func="http://exslt.org/functions" version="1.0"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> - <xsl:param name="filenamep" /> - <xsl:variable name="filename" select="$filenamep"/> - <!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>--> - <xsl:variable name="maxxCoord"><xsl:value-of select="600" /></xsl:variable> - <xsl:variable name="maxyCoord"><xsl:value-of select="800" /></xsl:variable> - <xsl:variable name="minxCoord"><xsl:value-of select="0" /></xsl:variable> - <xsl:variable name="minyCoord"><xsl:value-of select="0" /></xsl:variable> +<xsl:param name="filenamep" /> +<xsl:variable name="filename" select="$filenamep"/> +<!--<xsl:variable name="maxxCoord"><xsl:value-of select="math:max(map//xCoord)" /></xsl:variable>--> +<!-- root element --> +<xsl:template match="/"> + <xsl:element name="vymmap"> + <!-- default settings: --> + <xsl:attribute name="comment">Generated with mmap2vym (V0.1.2) - MindManager to vym converter. More infos: www.clemens-kraus.de</xsl:attribute> - <!-- root element --> - <xsl:template match="/"> - - <xsl:element name="vymmap"> - <!-- default settings: --> - <xsl:attribute name="comment">Generated with mmap2vym (V0.1.2) - MindManager to vym converter. More infos: www.clemens-kraus.de</xsl:attribute> + <xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" /> + <xsl:if test="$author"> + <xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute> + </xsl:if> + + <xsl:element name="mapcenter"> + <!-- recurse to map title node ... --> + <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:Text"/> + <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" /> + </xsl:element> + </xsl:element> +</xsl:template> - <xsl:variable name="author" select="concat(/ap:Map/ap:DocumentGroup/ap:Author/@UserName, ' ', /ap:Map/ap:DocumentGroup/ap:Author/@UserEmail)" /> - <xsl:if test="$author"> - <xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute> - </xsl:if> - - <xsl:element name="mapcenter"> - <!--xsl:attribute name="absPosX"><xsl:value-of select="300"/></xsl:attribute--> - <!--xsl:attribute name="absPosY"><xsl:value-of select="400"/></xsl:attribute--> - <!--xsl:attribute name="absPosX"><xsl:value-of select="- floor($minxCoord * 0.6) - 30"/></xsl:attribute--> - <!--xsl:attribute name="absPosY"><xsl:value-of select="floor($maxyCoord * 0.6)"/></xsl:attribute--> - <!-- xsl:message>absPos: <xsl:value-of select="- - floor($minxCoord * 0.6) - 30"/></xsl:message --> +<xsl:template match="ap:Topic/ap:Text"> + <xsl:element name="heading"> + <xsl:value-of select="@PlainText" /> + </xsl:element> +</xsl:template> - <!-- recurse to map title node ... --> - <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:Text"/> - - <xsl:apply-templates select="ap:Map/ap:OneTopic/ap:Topic/ap:SubTopics" /> - - </xsl:element> - - </xsl:element> - </xsl:template> - <xsl:template match="ap:Topic/ap:Text"> - <xsl:element name="heading"> - <xsl:value-of select="@PlainText" /> - </xsl:element> - </xsl:template> +<xsl:template match="ap:Topic"> + <xsl:element name="branch"> + <xsl:call-template name="position" /> + <!-- =============================== hyperlink ================================ --> + <xsl:variable name="url" select="ap:Hyperlink" /> + <xsl:if test="$url"> + <xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute> + </xsl:if> - - <xsl:template match="ap:Topic"> - - <xsl:element name="branch"> - <xsl:call-template name="position" /> + <xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" /> + <xsl:if test="contains($rect, 'Rectangle')"> + <xsl:attribute name="frameType">Rectangle</xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </xsl:element> +</xsl:template> - <!-- =============================== hyperlink ================================ --> - <xsl:variable name="url" select="ap:Hyperlink" /> - <xsl:if test="$url"> - <xsl:attribute name="url"><xsl:value-of select="ap:Hyperlink/@Url"/></xsl:attribute> - </xsl:if> - - <xsl:variable name="rect" select="ap:SubTopicShape/@SubTopicShape" /> - <xsl:if test="contains($rect, 'Rectangle')"> - <xsl:attribute name="frameType">Rectangle</xsl:attribute> - <!--<xsl:message><xsl:text>Rectangle</xsl:text><xsl:value-of select="$rect"/></xsl:message>--> - </xsl:if> - - <!-- =============================== closed ================================ --> - <!-- is branch closed? --> - <xsl:variable name="collapsed" select="ap:TopicViewGroup/Collapsed/@Collapsed" /> - <xsl:if test="$collapsed = 'true'"> - <xsl:attribute name="scrolled"> - <xsl:value-of select="yes"/> - </xsl:attribute> - </xsl:if> - <xsl:element name="heading"> - <xsl:if test="ap:Text/ap:Font/@Color"> - <xsl:attribute name="textColor"> - <xsl:value-of select="concat('#', substring(ap:Text/ap:Font/@Color, 3, 6))" /> - </xsl:attribute> - </xsl:if> - <xsl:value-of select="ap:Text/@PlainText" /> - - <!-- <xsl:variable name="OId" select="@OId" /> - <xsl:variable name="relation" select="/ap:Map/ap:Relationships/ap:Relationship[ap:ConnectionGroup[@Index=0]/ap:Connection/ap:ObjectReference/@OIdRef=$OId]" /> - <xsl:if test="$relation"> - <xsl:variable name="toId" select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" /> - <xsl:element name="arrowlink"> - <xsl:attribute name="ENDARROW">Default</xsl:attribute> - <xsl:attribute name="DESTINATION"> - <xsl:value-of select="$relation/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference/@OIdRef" /> - </xsl:attribute> - <xsl:attribute name="STARTARROW">None</xsl:attribute> - </xsl:element> - </xsl:if> - <xsl:variable name="toId" select="/ap:Map/ap:Relationships/ap:Relationship/ap:ConnectionGroup[@Index=1]/ap:Connection/ap:ObjectReference[@OIdRef=$OId]/@OIdRef" /> - <xsl:if test="$toId"> - <xsl:attribute name="ID"> - <xsl:value-of select="$toId" /> - </xsl:attribute> - </xsl:if> --> - - </xsl:element> - - <!-- =============================== createnote ================================ --> - <xsl:variable name="note" select="ap:NotesGroup" /> - <xsl:if test="$note"> - <xsl:element name="htmlnote"> - <xsl:attribute name="fonthint">var</xsl:attribute> - <xsl:copy-of select="ap:NotesGroup/ap:NotesXhtmlData/*"/> - </xsl:element> - </xsl:if> - - <xsl:apply-templates select="ap:SubTopics"/> - </xsl:element> - - </xsl:template> - - - <!-- =============================== position ================================ --> - <!-- for position --> - <xsl:template name="position"> +<!-- =============================== position ================================ --> +<xsl:template name="position"> <xsl:if test="ap:Offset/@CX!=''"> <xsl:attribute name="relPosX"> - <xsl:value-of select="ap:Offset/@CX *3"/> + <xsl:value-of select="ap:Offset/@CX *3"/> </xsl:attribute> </xsl:if> <xsl:if test="ap:Offset/@CY!=''"> @@ -149,83 +81,9 @@ <xsl:value-of select="floor( ap:Offset/@CY *3 )"/> </xsl:attribute> </xsl:if> - - </xsl:template> +</xsl:template> - <!-- ========================== symbol (floatimage) =========================== --> - <!-- any floatimage? --> - <xsl:template match="symbol"> - - <xsl:if test="string-length(./url) > 0"> - <xsl:variable name="imagename" > - <xsl:call-template name="getfn" > - <xsl:with-param name="txt" select="substring-before( translate( normalize-space( current() ), '\', '/' ), '.' )" /> - </xsl:call-template> - </xsl:variable> - - <xsl:element name="floatimage"> - <xsl:attribute name="relPosX"> - <xsl:value-of select="'20'"/> - </xsl:attribute> - <xsl:attribute name="relPosY"> - <xsl:value-of select="'-50'"/> - </xsl:attribute> - <xsl:attribute name="useOrientation"> - <xsl:text>true</xsl:text> - </xsl:attribute> - <xsl:attribute name="saveInMap"> - <xsl:text>true</xsl:text> - </xsl:attribute> - - <xsl:attribute name="href"> - <xsl:value-of select="concat('file:', $filename, '-image-', $imagename, '.png')"/> - </xsl:attribute> - </xsl:element> - </xsl:if> - - </xsl:template> - - - <!-- =============================== hyperlink ================================ --> - <xsl:template match="xhyperLink"> - - <xsl:choose> - <xsl:when test="substring(., 1, 4)='http'"> - <xsl:attribute name="url"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:when> - - <xsl:when test="contains(., '.mmp')"> - <xsl:attribute name="vymLink"> - <!-- Aus .mmp .vym machen und '\' durch '/' ersetzen --> - <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/> - </xsl:attribute> - </xsl:when> - - <xsl:otherwise> - <!-- <xsl:message terminate="yes">Test: <xsl:value-of select="."/></xsl:message> --> - <xsl:attribute name="url"> - <xsl:value-of select="concat( 'file:/', translate(current(), '\', '/') )"/> - </xsl:attribute> - </xsl:otherwise> - </xsl:choose> - - -<!-- <xsl:if test="substring(., 1, 4)='http'"> - <xsl:attribute name="url"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:if> - - <xsl:if test="contains(., '.mmp')"> - <xsl:attribute name="vymLink"> - <xsl:value-of select="translate( concat(substring-before(current(),'.mmp'), '.vym'), '\', '/')"/> - </xsl:attribute> - </xsl:if> --> - - </xsl:template> <!-- ================================= getfn ================================== --> @@ -233,7 +91,6 @@ <xsl:template name="getfn"> <xsl:param name="txt" select="." /> - <xsl:choose> <xsl:when test="contains($txt, '/')" > <xsl:variable name="right" select="substring-after($txt, '/')" /> @@ -252,46 +109,18 @@ <!-- =============================== Icons ================================ --> <xsl:template match="ap:Icon"> - <xsl:message>Icon found</xsl:message> <xsl:element name="standardFlag"> - <xsl:value-of select="@IconType"/> + <xsl:choose> + <xsl:when test="@IconType ='urn:mindjet:ExclamationMark'">exclamationmark</xsl:when> + <xsl:when test="@IconType ='urn:mindjet:SmileyHappy'">smiley-good</xsl:when> + <xsl:when test="@IconType ='urn:mindjet:SmileySad'">smiley-sad</xsl:when> + <xsl:otherwise> + <xsl:message>Unknown Flag found: <xsl:value-of select="@IconType"/></xsl:message> + </xsl:otherwise> + </xsl:choose> </xsl:element> - <xsl:message>absPos: <xsl:value-of select="@IconType"/> - </xsl:message> </xsl:template> - - <!-- =============================== codes ================================ --> - <xsl:template match="codes"> - - <!-- file:/home/clemens/CLEMENS/MM/Tools/Open Interface Reference Guide/doc/enum-mmcode.html --> - <xsl:element name="standardFlag"> - <xsl:choose> - <xsl:when test="code = '1'">lamp</xsl:when> - <xsl:when test="code = '2'">arrow-up</xsl:when> - <xsl:when test="code = '3'">arrow-down</xsl:when> - <!-- <xsl:when test="code = ">scrolled-right</xsl:when> --> - <xsl:when test="code = '5'">hook-green</xsl:when> - <xsl:when test="code = '6'">questionmark</xsl:when> - <xsl:when test="code = '7'">smiley-good</xsl:when> - <xsl:when test="code = '8'">smiley-sad</xsl:when> - <xsl:when test="code = '11'">stopsign</xsl:when> - <xsl:when test="code = '13'">clock</xsl:when> - <xsl:when test="code = '15'">clock</xsl:when> - <xsl:when test="code = '17'">cross-red</xsl:when> - <xsl:when test="code = '41'">cross-red</xsl:when> - <xsl:when test="code = '20'">exclamationmark</xsl:when> - <xsl:when test="code = '29'">thumb-up</xsl:when> - <!-- <xsl:when test="code = '9'">note</xsl:when> - <xsl:when test="code = '32'">note</xsl:when> --> - <xsl:otherwise>heart</xsl:otherwise> - </xsl:choose> - <!-- Fuer spaetere Erweiterung um eigene Codes: z.B. MindManager-Codes "code-9.png" - <xsl:value-of select="concat( 'code-', current() )"/> --> -</xsl:element> - -</xsl:template> - <!-- =============================== color ================================ --> <xsl:template match="color"> @@ -304,53 +133,6 @@ </xsl:attribute> </xsl:template> - - <!-- =============================== for future use ================================ --> - <xsl:template match="Name"> - <xsl:attribute name="NAME"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> - - <xsl:template match="Size"> - <xsl:attribute name="SIZE"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> - - <xsl:template match="Bold"> - <xsl:attribute name="BOLD"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> - - <xsl:template match="Italic"> - <xsl:attribute name="ITALIC"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> - - <xsl:template match="Underline"> - <xsl:attribute name="UNDERLINE"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> - - <xsl:template match="Strikethrough"> - <xsl:attribute name="Strikethrough"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> - - <!-- template extracting a subset of font attributes --> - <xsl:template match="ap:font"> - <xsl:apply-templates select="@Name"/> - <xsl:apply-templates select="@Size"/> - <xsl:apply-templates select="@Bold"/> - <xsl:apply-templates select="@Italic"/> - <xsl:apply-templates select="@Underline"/> - <xsl:apply-templates select="@Strikethrough"/> - </xsl:template> </xsl:stylesheet> diff -r 160459d924a1 -r a860efcaac4c styles/vym2xhtml.xsl --- a/styles/vym2xhtml.xsl Thu Feb 23 08:37:39 2006 +0000 +++ b/styles/vym2xhtml.xsl Thu Feb 23 16:39:16 2006 +0000 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!-- Namespace for XHTML -->