Skip to content

Instantly share code, notes, and snippets.

@echohn
Last active July 22, 2016 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echohn/4c5edcd8697b29cec9bafb36889e6953 to your computer and use it in GitHub Desktop.
Save echohn/4c5edcd8697b29cec9bafb36889e6953 to your computer and use it in GitHub Desktop.
safari auto backup bookmarks xslt file
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
<xsl:template match="plist">
<HTML>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />
<Title>书签</Title>
<H1>书签</H1>
<DL>
<xsl:apply-templates/>
</DL>
</HTML>
</xsl:template>
<xsl:template match="dict">
<xsl:variable name="title" select="string[preceding-sibling::key[text() = 'Title']]"/>
<xsl:if test="not($title = '')">
<DT>
<H3 FOLDED=""><xsl:value-of select="$title"/></H3>
</DT>
</xsl:if>
<DL><p/>
<xsl:apply-templates select="array"/>
</DL><p/>
</xsl:template>
<xsl:template match="dict[key[text() = 'URIDictionary']]">
<DT>
<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>
</DT>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment