author | insilmaril |
Wed, 05 Dec 2007 14:58:03 +0000 | |
changeset 631 | ba4a99830ad1 |
parent 37 | df767ed748f3 |
permissions | -rw-r--r-- |
insilmaril@37 | 1 |
<?xml version="1.0" encoding="UTF-8" ?> |
insilmaril@37 | 2 |
|
insilmaril@37 | 3 |
<!-- |
insilmaril@37 | 4 |
Document : vym2txt.xsl |
insilmaril@37 | 5 |
Created on : 20040317 |
insilmaril@37 | 6 |
Modified : 20040417 |
insilmaril@37 | 7 |
Version : 0.1 |
insilmaril@37 | 8 |
Author : Clemens Kraus (http://www.clemens-kraus.de) |
insilmaril@37 | 9 |
Description: transforms vym-files into text-format. |
insilmaril@37 | 10 |
|
insilmaril@37 | 11 |
--> |
insilmaril@37 | 12 |
|
insilmaril@37 | 13 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
insilmaril@37 | 14 |
|
insilmaril@37 | 15 |
<xsl:output method="text" indent="no" encoding="UTF-8"/> |
insilmaril@37 | 16 |
<xsl:param name="filenamep" /> |
insilmaril@37 | 17 |
<xsl:variable name="filename" select="$filenamep"/> |
insilmaril@37 | 18 |
|
insilmaril@37 | 19 |
<xsl:variable name="fn" > |
insilmaril@37 | 20 |
<xsl:call-template name="getfn" > |
insilmaril@37 | 21 |
<xsl:with-param name="txt" select="$filename" /> |
insilmaril@37 | 22 |
</xsl:call-template> |
insilmaril@37 | 23 |
</xsl:variable> |
insilmaril@37 | 24 |
|
insilmaril@37 | 25 |
<xsl:variable name="path" > |
insilmaril@37 | 26 |
<xsl:value-of select="normalize-space( substring($filename, 1, number(string-length($filename)-string-length($fn))) )" /> |
insilmaril@37 | 27 |
</xsl:variable> |
insilmaril@37 | 28 |
|
insilmaril@37 | 29 |
|
insilmaril@37 | 30 |
<xsl:template match="/"> |
insilmaril@37 | 31 |
|
insilmaril@37 | 32 |
<xsl:text>#VYM-Export VYM-Version:</xsl:text><xsl:value-of select="vymmap/@version"/> |
insilmaril@37 | 33 |
<xsl:text>

</xsl:text> |
insilmaril@37 | 34 |
|
insilmaril@37 | 35 |
|
insilmaril@37 | 36 |
<xsl:value-of select="vymmap/mapcenter/heading"/> |
insilmaril@37 | 37 |
<xsl:text>

</xsl:text> |
insilmaril@37 | 38 |
|
insilmaril@37 | 39 |
|
insilmaril@37 | 40 |
<xsl:apply-templates select="vymmap/mapcenter/branch" > |
insilmaril@37 | 41 |
<xsl:with-param name="indent" select="''" /> |
insilmaril@37 | 42 |
</xsl:apply-templates> |
insilmaril@37 | 43 |
|
insilmaril@37 | 44 |
</xsl:template> |
insilmaril@37 | 45 |
|
insilmaril@37 | 46 |
|
insilmaril@37 | 47 |
|
insilmaril@37 | 48 |
|
insilmaril@37 | 49 |
<xsl:template match="branch"> |
insilmaril@37 | 50 |
<xsl:param name="width" select="70" /> |
insilmaril@37 | 51 |
|
insilmaril@37 | 52 |
|
insilmaril@37 | 53 |
<xsl:call-template name="gen-anchor-tag" > |
insilmaril@37 | 54 |
<xsl:with-param name="indent" select="$indent" /> |
insilmaril@37 | 55 |
</xsl:call-template> |
insilmaril@37 | 56 |
|
insilmaril@37 | 57 |
|
insilmaril@37 | 58 |
<xsl:apply-templates select="branch" > |
insilmaril@37 | 59 |
<xsl:with-param name="indent" select="concat($indent, ' ')" /> |
insilmaril@37 | 60 |
</xsl:apply-templates> |
insilmaril@37 | 61 |
|
insilmaril@37 | 62 |
</xsl:template> |
insilmaril@37 | 63 |
|
insilmaril@37 | 64 |
|
insilmaril@37 | 65 |
|
insilmaril@37 | 66 |
|
insilmaril@37 | 67 |
<xsl:template name="gen-anchor-tag"> |
insilmaril@37 | 68 |
<xsl:param name="indent"/> |
insilmaril@37 | 69 |
|
insilmaril@37 | 70 |
<xsl:value-of select="$indent"/><xsl:text>- </xsl:text><xsl:value-of select="heading"/> |
insilmaril@37 | 71 |
|
insilmaril@37 | 72 |
|
insilmaril@37 | 73 |
<xsl:if test="@url != ''"> (<xsl:value-of select="@url"/>)</xsl:if> |
insilmaril@37 | 74 |
|
insilmaril@37 | 75 |
|
insilmaril@37 | 76 |
<xsl:apply-templates select="note/@href" > |
insilmaril@37 | 77 |
<xsl:with-param name="indent" select="$indent" /> |
insilmaril@37 | 78 |
</xsl:apply-templates> |
insilmaril@37 | 79 |
|
insilmaril@37 | 80 |
<xsl:text>
</xsl:text> |
insilmaril@37 | 81 |
</xsl:template> |
insilmaril@37 | 82 |
|
insilmaril@37 | 83 |
|
insilmaril@37 | 84 |
|
insilmaril@37 | 85 |
|
insilmaril@37 | 86 |
|
insilmaril@37 | 87 |
<xsl:template match="note/@href"> |
insilmaril@37 | 88 |
<xsl:param name="indent"/> |
insilmaril@37 | 89 |
|
insilmaril@37 | 90 |
<xsl:variable name="actualnotename"> |
insilmaril@37 | 91 |
<xsl:value-of select="substring-after(current(),':')"/> |
insilmaril@37 | 92 |
</xsl:variable> |
insilmaril@37 | 93 |
|
insilmaril@37 | 94 |
<xsl:variable name="note-name"> |
insilmaril@37 | 95 |
<xsl:if test="$path = ''"> |
insilmaril@37 | 96 |
<xsl:value-of select="$actualnotename"/> |
insilmaril@37 | 97 |
</xsl:if> |
insilmaril@37 | 98 |
<xsl:if test="not($path = '')"> |
insilmaril@37 | 99 |
<xsl:value-of select="concat($path, '/', $actualnotename)"/> |
insilmaril@37 | 100 |
</xsl:if> |
insilmaril@37 | 101 |
</xsl:variable> |
insilmaril@37 | 102 |
|
insilmaril@37 | 103 |
|
insilmaril@37 | 104 |
<xsl:variable name="currentID" select="@id" /> |
insilmaril@37 | 105 |
|
insilmaril@37 | 106 |
<xsl:text>
</xsl:text> |
insilmaril@37 | 107 |
|
insilmaril@37 | 108 |
<xsl:for-each select="document($note-name)/note/line"> |
insilmaril@37 | 109 |
<xsl:value-of select="$indent"/><xsl:text> </xsl:text><xsl:value-of select="."/> |
insilmaril@37 | 110 |
</xsl:for-each> |
insilmaril@37 | 111 |
|
insilmaril@37 | 112 |
</xsl:template> |
insilmaril@37 | 113 |
|
insilmaril@37 | 114 |
|
insilmaril@37 | 115 |
|
insilmaril@37 | 116 |
|
insilmaril@37 | 117 |
|
insilmaril@37 | 118 |
<xsl:template name="getfn"> |
insilmaril@37 | 119 |
<xsl:param name="txt" select="." /> |
insilmaril@37 | 120 |
|
insilmaril@37 | 121 |
<xsl:choose> |
insilmaril@37 | 122 |
<xsl:when test="contains($txt, '/')" > |
insilmaril@37 | 123 |
<xsl:variable name="right" select="substring-after($txt, '/')" /> |
insilmaril@37 | 124 |
<xsl:if test="string-length($right)>1" > |
insilmaril@37 | 125 |
<xsl:call-template name="getfn" > |
insilmaril@37 | 126 |
<xsl:with-param name="txt" select="$right" /> |
insilmaril@37 | 127 |
</xsl:call-template> |
insilmaril@37 | 128 |
</xsl:if> |
insilmaril@37 | 129 |
</xsl:when> |
insilmaril@37 | 130 |
<xsl:otherwise> |
insilmaril@37 | 131 |
<xsl:value-of select="$txt" /> |
insilmaril@37 | 132 |
</xsl:otherwise> |
insilmaril@37 | 133 |
</xsl:choose> |
insilmaril@37 | 134 |
|
insilmaril@37 | 135 |
</xsl:template> |
insilmaril@37 | 136 |
|
insilmaril@37 | 137 |
</xsl:stylesheet> |
insilmaril@37 | 138 |