1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/styles/vym2kdebookmarks.xsl Wed Jan 16 15:45:19 2008 +0000
1.3 @@ -0,0 +1,133 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!DOCTYPE xsl:stylesheet
1.6 +[
1.7 + <!-- Namespace for XHTML -->
1.8 + <!ENTITY xhtmlns "http://www.w3.org/1999/xhtml">
1.9 +]>
1.10 +
1.11 +<!--
1.12 + Author : Uwe Drechsel <vym@InSilmaril.de>
1.13 + Credits to : Thomas Schraitle for his patience in explaining XSL to me
1.14 + Description : transforms vym maps into KDE Bookmarks
1.15 +-->
1.16 +
1.17 +<xsl:stylesheet version="1.0"
1.18 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.19 + xmlns:date="http://exslt.org/dates-and-times"
1.20 + extension-element-prefixes="date">
1.21 +
1.22 +
1.23 +<xsl:output method="xml"
1.24 + doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
1.25 + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
1.26 + encoding="UTF-8"
1.27 + indent="yes"
1.28 + media-type="application/xhtml+xml"/>
1.29 +
1.30 +<!-- ======================================= -->
1.31 +
1.32 +<xsl:template match="/">
1.33 + <xsl:apply-templates/>
1.34 +</xsl:template>
1.35 +
1.36 +
1.37 +<xsl:template match="text()"/>
1.38 +
1.39 +
1.40 +<xsl:template match="vymmap">
1.41 + <xbel>
1.42 + <xsl:apply-templates/>
1.43 + </xbel>
1.44 +</xsl:template>
1.45 +
1.46 +
1.47 +<xsl:template match="mapcenter">
1.48 +
1.49 + <xsl:apply-templates/>
1.50 +</xsl:template>
1.51 +
1.52 +
1.53 +<xsl:template match="branch">
1.54 + <xsl:choose>
1.55 + <xsl:when test="heading='KDE'">
1.56 + <xsl:apply-templates select="branch" mode="kde"/>
1.57 + </xsl:when>
1.58 + <xsl:when test=". = 'Firefox'">
1.59 + <xsl:apply-templates mode="firefox"/>
1.60 + </xsl:when>
1.61 + <!-- ... -->
1.62 + <xsl:otherwise>
1.63 + <xsl:apply-templates/>
1.64 + </xsl:otherwise>
1.65 + </xsl:choose>
1.66 +
1.67 + <xsl:apply-templates/>
1.68 +</xsl:template>
1.69 +
1.70 +<xsl:template match="heading" mode="kde">
1.71 + <title>
1.72 + <xsl:value-of select="normalize-space (.)"/>
1.73 + </title>
1.74 +
1.75 + <xsl:choose>
1.76 + <xsl:when test=". = 'KDE'">
1.77 + <xsl:apply-templates mode="kde"/>
1.78 + </xsl:when>
1.79 + <xsl:otherwise>
1.80 + <xsl:apply-templates/>
1.81 + </xsl:otherwise>
1.82 + </xsl:choose>
1.83 +
1.84 + <xsl:apply-templates/>
1.85 +</xsl:template>
1.86 +
1.87 +
1.88 +<xsl:template match="branch" mode="kde">
1.89 + <xsl:choose>
1.90 + <xsl:when test="@url">
1.91 + <xsl:element name="bookmark">
1.92 + <xsl:attribute name="href" ><xsl:value-of select="@url" />
1.93 + </xsl:attribute>
1.94 + <xsl:apply-templates mode="kde"/>
1.95 + </xsl:element>
1.96 + </xsl:when>
1.97 + <xsl:otherwise>
1.98 + <xsl:choose>
1.99 + <xsl:when test="contains(heading,'***')">
1.100 + <separator folded="yes" />
1.101 + </xsl:when>
1.102 + <xsl:otherwise>
1.103 + <folder folded="yes" icon="bookmark_folder">
1.104 + <xsl:apply-templates mode="kde"/>
1.105 + </folder>
1.106 + </xsl:otherwise>
1.107 + </xsl:choose>
1.108 +
1.109 + </xsl:otherwise>
1.110 + </xsl:choose>
1.111 +</xsl:template>
1.112 +
1.113 +<!--
1.114 + <xsl:text> </xsl:text>
1.115 +
1.116 + <xsl:message> WARNING: No @url attribute given of "<xsl:value-of select="normalize-space(heading)"/>"</xsl:message>
1.117 +
1.118 +<xsl:template match="branch">
1.119 + <xsl:choose>
1.120 + <xsl:when test="@url">
1.121 + <xsl:text> *nokde* </xsl:text>
1.122 + <xsl:value-of select="@url"/>
1.123 + <xsl:text> </xsl:text>
1.124 + </xsl:when>
1.125 + <xsl:otherwise>
1.126 + <xsl:message> WARNING: No @url attribute given of "<xsl:value-of select="normalize-space(heading)"/>"</xsl:message>
1.127 + </xsl:otherwise>
1.128 + </xsl:choose>
1.129 +
1.130 + <xsl:apply-templates/>
1.131 +
1.132 +</xsl:template>
1.133 +-->
1.134 +
1.135 +
1.136 +</xsl:stylesheet>