Skip to content

Commit

Permalink
Merge pull request #44 from hokorobi/better-mm2html
Browse files Browse the repository at this point in the history
better mm2html.xsl
  • Loading branch information
fnatter committed Mar 21, 2015
2 parents 9c95b5b + e0987d5 commit 737d3d9
Showing 1 changed file with 124 additions and 114 deletions.
238 changes: 124 additions & 114 deletions freeplane/external-resources/xslt/mm2html.xsl
Original file line number Diff line number Diff line change
@@ -1,139 +1,149 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
MINDMAPEXPORTFILTER html;htm %xslt_export.html
: This code released under the GPL.
: (http://www.gnu.org/copyleft/gpl.html) Document : mindmap2html.xsl
Created on : 01 February 2004, 17:17 Author : joerg feuerhake
joerg.feuerhake@free-penguin.org Description: transforms freeplane mm
format to html, handles crossrefs font declarations and colors. feel
free to customize it while leaving the ancient authors mentioned.
thank you ChangeLog: See: http://freeplane.sourceforge.net/
-->
<!--
MINDMAPEXPORTFILTER html;htm %xslt_export.html
: This code released under the GPL.
: (http://www.gnu.org/copyleft/gpl.html) Document : mindmap2html.xsl
Created on : 01 February 2004, 17:17 Author : joerg feuerhake
joerg.feuerhake@free-penguin.org Description: transforms freeplane mm
format to html, handles crossrefs font declarations and colors. feel
free to customize it while leaving the ancient authors mentioned.
thank you ChangeLog: See: http://freeplane.sourceforge.net/
-->

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="ISO-8859-1" />

<xsl:template match="/">
<xsl:variable name="mapversion" select="map/@version" />

<html>&#xA;
<head>&#xA;
<title><xsl:value-of select="map/node/@TEXT"/>//mm2html.xsl FreeplaneVersion:<xsl:value-of select="$mapversion"/></title>&#xA;
<style>
body{
font-size:10pt;
color:rgb(0,0,0);
backgound-color:rgb(255,255,255);
font-family:sans-serif;
}
p.info{
font-size:8pt;
text-align:right;
color:rgb(127,127,127);
}
</style>
</head>
&#xA;
<body>
&#xA;

<p>
<xsl:apply-templates/>
</p>
<p class="info">
<xsl:value-of select="map/node/@TEXT"/>//mm2html.xsl FreeplaneVersion:<xsl:value-of select="$mapversion"/>
&#xA;
</p>
</body>&#xA;
</html>&#xA;
</xsl:template>

<xsl:template match="node">

<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="nodetext" select="@TEXT"/>
<xsl:variable name="thisid" select="@ID"/>
<xsl:variable name="thiscolor" select="@COLOR"/>
<xsl:variable name="fontface" select="font/@NAME"/>
<xsl:variable name="fontbold" select="font/@BOLD"/>
<xsl:variable name="fontitalic" select="font/@ITALIC"/>
<xsl:variable name="fontsize" select="font/@SIZE"/>
<xsl:variable name="target" select="arrowlink/@DESTINATION"/>



<ul>&#xA;
<li>&#xA;
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="ISO-8859-1" />

<xsl:template match="/">
<xsl:variable name="mapversion" select="map/@version" />

<html>
<head>
<title><xsl:value-of select="map/node/@TEXT"/>//mm2html.xsl FreeplaneVersion:<xsl:value-of select="$mapversion"/></title>
<style>
body{
font-size:10pt;
color:rgb(0,0,0);
backgound-color:rgb(255,255,255);
font-family:sans-serif;
}
p.info{
font-size:8pt;
text-align:right;
color:rgb(127,127,127);
}
</style>
</head>
<body>

<xsl:apply-templates/>

<p class="info">
<xsl:value-of select="map/node/@TEXT"/>//mm2html.xsl FreeplaneVersion:<xsl:value-of select="$mapversion"/>
</p>
</body>
</html>
</xsl:template>

<xsl:template match="map_styles">
</xsl:template>

<xsl:template match="node">

<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="nodetext" select="@TEXT"/>
<xsl:variable name="thisid" select="@ID"/>
<xsl:variable name="thiscolor" select="@COLOR"/>
<xsl:variable name="fontface" select="font/@NAME"/>
<xsl:variable name="fontbold" select="font/@BOLD"/>
<xsl:variable name="fontitalic" select="font/@ITALIC"/>
<xsl:variable name="fontsize" select="font/@SIZE"/>
<xsl:variable name="target" select="arrowlink/@DESTINATION"/>

<ul>
<li>

<xsl:if test="@ID != ''">
<a>
<a>
<xsl:attribute name="name">
<xsl:value-of select="$thisid"/>
<xsl:value-of select="$thisid"/>
</xsl:attribute>
</a>&#xA;
</a>
</xsl:if>

<xsl:if test="arrowlink/@DESTINATION != ''">
<a >
<a >
<xsl:attribute name="style">
<xsl:if test="$thiscolor != ''">
<xsl:text>color:</xsl:text><xsl:value-of select="$thiscolor"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontface != ''">
<xsl:text>font-family:</xsl:text><xsl:value-of select="translate($fontface,$ucletters,$lcletters)"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontsize != ''">
<xsl:if test="$thiscolor != ''">
<xsl:text>color:</xsl:text><xsl:value-of select="$thiscolor"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontface != ''">
<xsl:text>font-family:</xsl:text><xsl:value-of select="translate($fontface,$ucletters,$lcletters)"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontsize != ''">
<xsl:text>font-size:</xsl:text><xsl:value-of select="$fontsize"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontbold = 'true'">
<xsl:text>font-weight:bold;</xsl:text>
</xsl:if>
<xsl:if test="$fontitalic = 'true'">
<xsl:text>font-style:italic;</xsl:text>
</xsl:if>
</xsl:attribute>
</xsl:if>
<xsl:if test="$fontbold = 'true'">
<xsl:text>font-weight:bold;</xsl:text>
</xsl:if>
<xsl:if test="$fontitalic = 'true'">
<xsl:text>font-style:italic;</xsl:text>
</xsl:if>
</xsl:attribute>

<xsl:attribute name="href">
<xsl:text>#</xsl:text><xsl:value-of select="$target"/>
<xsl:text>#</xsl:text><xsl:value-of select="$target"/>
</xsl:attribute>

<xsl:value-of select="$nodetext"/>
</a>&#xA;
</a>
</xsl:if>

<xsl:if test="not(arrowlink/@DESTINATION)">
<span>
<xsl:attribute name="style">
<xsl:if test="$thiscolor != ''">
<xsl:text>color:</xsl:text><xsl:value-of select="$thiscolor"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontface != ''">
<xsl:text>font-family:</xsl:text><xsl:value-of select="translate($fontface,$ucletters,$lcletters)"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontsize != ''">
<xsl:text>font-size:</xsl:text><xsl:value-of select="$fontsize"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontbold = 'true'">
<xsl:text>font-weight:bold;</xsl:text>
</xsl:if>
<xsl:if test="$fontitalic = 'true'">
<xsl:text>font-style:italic;</xsl:text>
</xsl:if>
</xsl:attribute>
<xsl:value-of select="$nodetext"/>&#xA;
</span>&#xA;

<pre>

<xsl:attribute name="style">
<xsl:if test="$thiscolor != ''">
<xsl:text>color:</xsl:text><xsl:value-of select="$thiscolor"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontface != ''">
<xsl:text>font-family:</xsl:text><xsl:value-of select="translate($fontface,$ucletters,$lcletters)"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontsize != ''">
<xsl:text>font-size:</xsl:text><xsl:value-of select="$fontsize"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$fontbold = 'true'">
<xsl:text>font-weight:bold;</xsl:text>
</xsl:if>
<xsl:if test="$fontitalic = 'true'">
<xsl:text>font-style:italic;</xsl:text>
</xsl:if>
</xsl:attribute>
<xsl:value-of select="$nodetext"/>
</pre>
</xsl:if>


<xsl:apply-templates/>
</li>&#xA;
</ul>&#xA;
</xsl:template>
<xsl:if test="current()/node/hook/@NAME='ExternalObject'">
<xsl:call-template name="ExternalObject"></xsl:call-template>
</xsl:if>

</li>
</ul>
</xsl:template>

<xsl:template name="ExternalObject">
<img>
<xsl:attribute name="src">
<xsl:value-of select="current()/node/hook/@URI" disable-output-escaping="yes"/>
</xsl:attribute>
</img>
</xsl:template>


</xsl:stylesheet>
</xsl:stylesheet>

0 comments on commit 737d3d9

Please sign in to comment.