Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Our Archives > General Archives > Delicious Monster > xslt and Delicious Library - Tip

 
xslt and Delicious Library - Tip
Thread Tools
ajmas
Fresh-Faced Recruit
Join Date: Nov 2006
Status: Offline
Oct 5, 2007, 06:55 PM
 
For anyone interested in sharing the library with friends, here are some tips. For the purpose of this explanation I am going to assume that you have a web server on your machine and that you server root directory is at /Library/WebServer/Documents.

1 - Copy your library file, Library Media Data.xml, from ~/Library/Application Support/Delicious Library/ to the root directory of you web server. I recommend renaming it to something without spaces, such as mylibrary.xml.
2 - Copy the directory ~/Library/Application Support/Delicious Library/Images/Small Covers to the root of your web server.
3 - Edit the file mylibrary.xml (if that is the name you gave it) and add the line:

<?xml-stylesheet type="text/xsl" href="delicious-library.xsl"?>

after then line that reads:

<?xml version="1.0" encoding="utf-8"?>

4 - Create a new file called delicious-library.xsl in the root folder of your web server and add the following text:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match="/library"> <html> <head> <style> .oddRow { background-color: #ffffff; } .evenRow { background-color: #eeeeff; } </style> </head> <body> <!-- Books --> <h2> Books </h2> <table border="0" cellspacing="0"> <xsl:for-each select="items/book"> <xsl:sort select="@title"/> <tr style="height: 100px"> <xsl:attribute name="class"> <xsl:choose> <xsl:when test="position() mod 2 = 1">oddRow</xsl:when> <xsl:otherwise>evenRow</xsl:otherwise> </xsl:choose> </xsl:attribute> <td align="center" valign="middle"> <img> <xsl:attribute name="src">Small Covers/<xsl:value-of select="@uuid"/></xsl:attribute> </img> </td> <td>&nbsp;&nbsp;</td> <td valign="top"><b><xsl:value-of select="@title"/></b> <br/>Author: <xsl:value-of select="@author"/> <br/>Publisher: <xsl:value-of select="@publisher"/> <br/>Series: <xsl:value-of select="@series"/> <br/>Volume: <xsl:value-of select="@numberInSeries"/> </td> </tr> </xsl:for-each> </table> <!-- Books --> <h2> Books </h2> <table border="0" cellspacing="0"> <xsl:for-each select="items/book"> <xsl:sort select="@title"/> <tr style="height: 100px"> <xsl:attribute name="class"> <xsl:choose> <xsl:when test="position() mod 2 = 1">oddRow</xsl:when> <xsl:otherwise>evenRow</xsl:otherwise> </xsl:choose> </xsl:attribute> <td align="center" valign="middle"> <img> <xsl:attribute name="src">Small Covers/<xsl:value-of select="@uuid"/></xsl:attribute> </img> </td> <td>&nbsp;&nbsp;</td> <td valign="top"><b><xsl:value-of select="@title"/></b> <br/>Author: <xsl:value-of select="@author"/> <br/>Publisher: <xsl:value-of select="@publisher"/> <br/>Series: <xsl:value-of select="@series"/> <br/>Volume: <xsl:value-of select="@numberInSeries"/> </td> </tr> </xsl:for-each> <!-- Movies --> <h2> Movies </h2> <table border="0" cellspacing="0"> <xsl:for-each select="items/movie"> <xsl:sort select="@title"/> <tr style="height: 100px"> <xsl:attribute name="class"> <xsl:choose> <xsl:when test="position() mod 2 = 1">oddRow</xsl:when> <xsl:otherwise>evenRow</xsl:otherwise> </xsl:choose> </xsl:attribute> <td align="center" valign="middle"> <img> <xsl:attribute name="src">Small Covers/<xsl:value-of select="@uuid"/></xsl:attribute> </img> </td> <td>&nbsp;&nbsp;</td> <td valign="top"><b><xsl:value-of select="@title"/></b> <br/>Author: <xsl:value-of select="@author"/> <br/>Publisher: <xsl:value-of select="@publisher"/> <br/>Series: <xsl:value-of select="@series"/> <br/>Volume: <xsl:value-of select="@numberInSeries"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
5 - Now from you web server, if it is running on the same machine:

http://localhost/mylibrary.xml

If your web server is not your local computer, then you will simply have to modify the steps with uploading instead of copying. Always be sure to modify a *copy* of your files, and not the originals. You don't want to get burnt if you make a mistake

Hope this proves of use. Have tested with Firefox and Safari.
( Last edited by ajmas; Oct 5, 2007 at 07:11 PM. )
     
 
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:24 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,