styles/vym2kdebookmarks.xsl
author insilmaril
Mon May 05 13:46:42 2008 +0000 (2008-05-05)
changeset 695 cade59622d81
permissions -rw-r--r--
Some code cleanup and experimental stuff to support animations later
insilmaril@12
     1
<?xml version="1.0" encoding="UTF-8"?>
insilmaril@12
     2
<!DOCTYPE xsl:stylesheet
insilmaril@12
     3
[
insilmaril@12
     4
   <!-- Namespace for XHTML -->
insilmaril@12
     5
   <!ENTITY xhtmlns "http://www.w3.org/1999/xhtml">
insilmaril@12
     6
]>
insilmaril@12
     7
insilmaril@12
     8
<!--
insilmaril@12
     9
    Author      : Uwe Drechsel  <vym@InSilmaril.de>
insilmaril@12
    10
	Credits to  : Thomas Schraitle for his patience in explaining XSL to me
insilmaril@12
    11
    Description : transforms vym maps into KDE Bookmarks
insilmaril@12
    12
-->
insilmaril@12
    13
insilmaril@12
    14
<xsl:stylesheet version="1.0"
insilmaril@12
    15
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
insilmaril@12
    16
    xmlns:date="http://exslt.org/dates-and-times"
insilmaril@12
    17
    extension-element-prefixes="date">
insilmaril@12
    18
insilmaril@12
    19
insilmaril@12
    20
<xsl:output method="xml"
insilmaril@12
    21
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
insilmaril@12
    22
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
insilmaril@12
    23
    encoding="UTF-8"
insilmaril@12
    24
    indent="yes"
insilmaril@12
    25
    media-type="application/xhtml+xml"/>
insilmaril@12
    26
insilmaril@12
    27
<!-- ======================================= -->
insilmaril@12
    28
insilmaril@12
    29
<xsl:template match="/">
insilmaril@12
    30
  <xsl:apply-templates/>
insilmaril@12
    31
</xsl:template>
insilmaril@12
    32
insilmaril@12
    33
insilmaril@12
    34
<xsl:template match="text()"/>
insilmaril@12
    35
insilmaril@12
    36
insilmaril@12
    37
<xsl:template match="vymmap">
insilmaril@12
    38
  <xbel>
insilmaril@12
    39
    <xsl:apply-templates/>
insilmaril@12
    40
  </xbel>
insilmaril@12
    41
</xsl:template>
insilmaril@12
    42
insilmaril@12
    43
insilmaril@12
    44
<xsl:template match="mapcenter">
insilmaril@12
    45
insilmaril@12
    46
  <xsl:apply-templates/>
insilmaril@12
    47
</xsl:template>
insilmaril@12
    48
insilmaril@12
    49
insilmaril@12
    50
<xsl:template match="branch">
insilmaril@12
    51
   <xsl:choose>
insilmaril@12
    52
     <xsl:when test="heading='KDE'">
insilmaril@12
    53
        <xsl:apply-templates select="branch" mode="kde"/>
insilmaril@12
    54
     </xsl:when>
insilmaril@12
    55
     <xsl:when test=". = 'Firefox'">
insilmaril@12
    56
        <xsl:apply-templates mode="firefox"/>
insilmaril@12
    57
     </xsl:when>
insilmaril@12
    58
     <!-- ... -->
insilmaril@12
    59
     <xsl:otherwise>
insilmaril@12
    60
       <xsl:apply-templates/>
insilmaril@12
    61
     </xsl:otherwise>
insilmaril@12
    62
   </xsl:choose>
insilmaril@12
    63
insilmaril@12
    64
  <xsl:apply-templates/>
insilmaril@12
    65
</xsl:template>
insilmaril@12
    66
insilmaril@12
    67
<xsl:template match="heading" mode="kde">
insilmaril@12
    68
      <title>		
insilmaril@12
    69
      <xsl:value-of select="normalize-space (.)"/>
insilmaril@12
    70
	  </title>
insilmaril@12
    71
insilmaril@12
    72
   <xsl:choose>
insilmaril@12
    73
     <xsl:when test=". = 'KDE'">
insilmaril@12
    74
        <xsl:apply-templates mode="kde"/>
insilmaril@12
    75
     </xsl:when>
insilmaril@12
    76
     <xsl:otherwise>
insilmaril@12
    77
       <xsl:apply-templates/>
insilmaril@12
    78
     </xsl:otherwise>
insilmaril@12
    79
   </xsl:choose>
insilmaril@12
    80
insilmaril@12
    81
  <xsl:apply-templates/>
insilmaril@12
    82
</xsl:template>
insilmaril@12
    83
insilmaril@12
    84
insilmaril@12
    85
<xsl:template match="branch" mode="kde">
insilmaril@12
    86
	<xsl:choose>
insilmaril@12
    87
		<xsl:when test="@url">
insilmaril@12
    88
			<xsl:element name="bookmark">	
insilmaril@12
    89
				<xsl:attribute name="href" ><xsl:value-of select="@url" />
insilmaril@12
    90
				</xsl:attribute>
insilmaril@12
    91
				<xsl:apply-templates mode="kde"/>
insilmaril@12
    92
			</xsl:element>
insilmaril@12
    93
		</xsl:when>
insilmaril@12
    94
		<xsl:otherwise>
insilmaril@12
    95
			<xsl:choose>
insilmaril@12
    96
				<xsl:when test="contains(heading,'***')">
insilmaril@12
    97
					<separator folded="yes" />
insilmaril@12
    98
				</xsl:when>
insilmaril@12
    99
				<xsl:otherwise>
insilmaril@12
   100
					<folder folded="yes" icon="bookmark_folder">
insilmaril@12
   101
						<xsl:apply-templates mode="kde"/>
insilmaril@12
   102
					</folder>
insilmaril@12
   103
				</xsl:otherwise>
insilmaril@12
   104
			</xsl:choose>	
insilmaril@12
   105
insilmaril@12
   106
	</xsl:otherwise>
insilmaril@12
   107
	</xsl:choose>
insilmaril@12
   108
</xsl:template>
insilmaril@12
   109
insilmaril@12
   110
<!--
insilmaril@12
   111
		  <xsl:text>&#10;</xsl:text>
insilmaril@12
   112
insilmaril@12
   113
				<xsl:message> WARNING: No @url attribute given of "<xsl:value-of select="normalize-space(heading)"/>"</xsl:message>
insilmaril@12
   114
insilmaril@12
   115
<xsl:template match="branch">
insilmaril@12
   116
  <xsl:choose>
insilmaril@12
   117
    <xsl:when test="@url">
insilmaril@12
   118
      <xsl:text> *nokde* </xsl:text>
insilmaril@12
   119
      <xsl:value-of select="@url"/>
insilmaril@12
   120
      <xsl:text>&#10;</xsl:text>
insilmaril@12
   121
    </xsl:when>
insilmaril@12
   122
    <xsl:otherwise>
insilmaril@12
   123
      <xsl:message> WARNING: No @url attribute given of "<xsl:value-of select="normalize-space(heading)"/>"</xsl:message>
insilmaril@12
   124
    </xsl:otherwise>
insilmaril@12
   125
  </xsl:choose>
insilmaril@12
   126
insilmaril@12
   127
  <xsl:apply-templates/>
insilmaril@12
   128
insilmaril@12
   129
</xsl:template>
insilmaril@12
   130
-->
insilmaril@12
   131
insilmaril@12
   132
insilmaril@12
   133
</xsl:stylesheet>