Created
November 21, 2013 01:38
-
-
Save py/7574625 to your computer and use it in GitHub Desktop.
Freeplane export xsl: Converts mindmap into markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- | |
MINDMAPEXPORTFILTER md;markdown Markdown | |
: This code released under the GPL. : | |
(http://www.gnu.org/copyleft/gpl.html) | |
Document : mm2markdown.xsl | |
Created on : 2013-11-20 | |
Author : Peter Yates | |
Description: transforms freeplane mm format to markdown. Feel free to | |
customize it while leaving the ancient authors mentioned. thank you | |
Based on mm2text.xsl by joerg feuerhake ([email protected]) | |
--> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="text" indent="no"/> | |
<xsl:strip-space elements="map node" /> | |
<xsl:key name="refid" match="node" use="@ID" /> | |
<xsl:template match="/map"> | |
<xsl:apply-templates select="node"/> | |
</xsl:template> | |
<xsl:template match="richcontent"> | |
<xsl:if test="@TYPE='DETAILS'"> | |
<xsl:text>"After details"</xsl:text> | |
</xsl:if> | |
<xsl:if test="@TYPE='NOTE'"> | |
</xsl:if> | |
<xsl:apply-templates/> | |
<xsl:text>
</xsl:text> | |
</xsl:template> | |
<xsl:template match="child::text()"> | |
<xsl:value-of select="normalize-space(.)" /> | |
</xsl:template> | |
<xsl:template match="node"> | |
<xsl:variable name ="dep" select="count(ancestor::*)" /> | |
<xsl:value-of select="substring('###########################',1,$dep)" /> | |
<xsl:text> </xsl:text> | |
<xsl:if test="@TEXT"> | |
<xsl:value-of select="normalize-space(@TEXT)" /> | |
<xsl:text>
</xsl:text> | |
</xsl:if> | |
<xsl:text>
</xsl:text> | |
<xsl:apply-templates select="richcontent[@TYPE='NODE']"/> | |
<xsl:apply-templates select="richcontent[@TYPE='DETAILS']"/> | |
<xsl:apply-templates select="richcontent[@TYPE='NOTE']"/> | |
<xsl:text>
</xsl:text> | |
<xsl:apply-templates select="node"/> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment