1 <?xml version='1.0' encoding='iso-8859-1'?>
3 <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
5 <xsl:output method='html' version='1.0' encoding='iso-8859-1' indent='no'/>
7 <!-- An XSLT style sheet to convert a Safari bookmarks list to HTML -->
8 <!-- You can find your Safari bookmarks file in your home directory under
9 Library / Safari / Bookmarks.plist -->
11 <!-- Written by Marc Liyanage (http://www.entropy.ch) -->
15 <!-- Match toplevel element, emit basic HTML document structure -->
17 <xsl:template match="plist">
23 <title>Safari Bookmarks</title>
25 <style type="text/css">
28 border-color: #333333;
31 margin: 10px 4px 4px 10px;
32 background-color: #cccccc;
34 .indent { margin-left: 10px; }
42 background-color: #333333;
50 margin: 2px 2px 2px 10px;
52 a { text-decoration: none; }
53 a:hover { text-decoration: underline; }
59 <!-- recursively create the body content -->
60 <xsl:apply-templates/>
71 <!-- This generic template matches dict entries which act as containers for other items -->
72 <xsl:template match="dict">
74 <xsl:variable name="title" select="string[preceding-sibling::key[text() = 'Title']]"/>
76 <div class="category">
77 <xsl:if test="$title"><div class="categorytitle"><xsl:value-of select="$title"/></div></xsl:if>
78 <xsl:apply-templates select="array"/>
84 <!-- This more specific template matches dict entries which contain a particular link. Because
85 it is more specific it will have precedence over the one above. -->
86 <xsl:template match="dict[key[text() = 'URIDictionary']]">
88 <div class="link"><a href="{string[preceding-sibling::key[text() = 'URLString']]}"><xsl:value-of select="dict[preceding-sibling::key[text() = 'URIDictionary']]/string[preceding-sibling::key[text() = 'title']]"/></a></div>