1 <?xml version="1.0" encoding="UTF-8" ?>
8 Author : Clemens Kraus (http://www.clemens-kraus.de)
9 Description: transforms vym-files into text-format.
13 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
15 <xsl:output method="text" indent="no" encoding="UTF-8"/>
16 <xsl:param name="filenamep" />
17 <xsl:variable name="filename" select="$filenamep"/>
19 <xsl:variable name="fn" >
20 <xsl:call-template name="getfn" >
21 <xsl:with-param name="txt" select="$filename" />
25 <xsl:variable name="path" >
26 <xsl:value-of select="normalize-space( substring($filename, 1, number(string-length($filename)-string-length($fn))) )" />
30 <xsl:template match="/">
32 <xsl:text>#VYM-Export VYM-Version:</xsl:text><xsl:value-of select="vymmap/@version"/>
33 <xsl:text>

</xsl:text>
36 <xsl:value-of select="vymmap/mapcenter/heading"/>
37 <xsl:text>

</xsl:text>
40 <xsl:apply-templates select="vymmap/mapcenter/branch" >
41 <xsl:with-param name="indent" select="''" />
42 </xsl:apply-templates>
49 <xsl:template match="branch">
50 <xsl:param name="width" select="70" />
53 <xsl:call-template name="gen-anchor-tag" >
54 <xsl:with-param name="indent" select="$indent" />
58 <xsl:apply-templates select="branch" >
59 <xsl:with-param name="indent" select="concat($indent, ' ')" />
60 </xsl:apply-templates>
67 <xsl:template name="gen-anchor-tag">
68 <xsl:param name="indent"/>
70 <xsl:value-of select="$indent"/><xsl:text>- </xsl:text><xsl:value-of select="heading"/>
73 <xsl:if test="@url != ''"> (<xsl:value-of select="@url"/>)</xsl:if>
76 <xsl:apply-templates select="note/@href" >
77 <xsl:with-param name="indent" select="$indent" />
78 </xsl:apply-templates>
80 <xsl:text>
</xsl:text>
87 <xsl:template match="note/@href">
88 <xsl:param name="indent"/>
90 <xsl:variable name="actualnotename">
91 <xsl:value-of select="substring-after(current(),':')"/>
94 <xsl:variable name="note-name">
95 <xsl:if test="$path = ''">
96 <xsl:value-of select="$actualnotename"/>
98 <xsl:if test="not($path = '')">
99 <xsl:value-of select="concat($path, '/', $actualnotename)"/>
104 <xsl:variable name="currentID" select="@id" />
106 <xsl:text>
</xsl:text>
108 <xsl:for-each select="document($note-name)/note/line">
109 <xsl:value-of select="$indent"/><xsl:text> </xsl:text><xsl:value-of select="."/>
118 <xsl:template name="getfn">
119 <xsl:param name="txt" select="." />
122 <xsl:when test="contains($txt, '/')" >
123 <xsl:variable name="right" select="substring-after($txt, '/')" />
124 <xsl:if test="string-length($right)>1" >
125 <xsl:call-template name="getfn" >
126 <xsl:with-param name="txt" select="$right" />
131 <xsl:value-of select="$txt" />