This is the permanent status page for XSL Flickr. XSL Flickr is an XSL interface to the Flickr Services API. Version 0.99 is hereby announced.
XSL Flickr is a library of templates that allow XSLT (1.0 or 2.0) stylesheets to access the Flickr Services API.
Version 0.99 from 29 November 2006 is the second release of XSL Flickr . Version 0.99 supports the Flickr Services API as of November, 2006.
This is a
XSLT. It should run
on any platform that supports
XSLT. You'll need an implementation of the
extension function to do anything useful with an XSLT 1.0 processor. You'll
also need an implementation of the
MD5 hashing algorithm if you want to use
any services that require authentication.
“xslflickr” package consists
of several files:
- flickr.xsl or flickr1.xsl
The Flickr Services API library in XSLT 2.0 or 1.0, respectively.
An XSLT 2.0 stylesheet that generates the API files from an XML description of the API. You don't actually need this unless you want to change something about the library files.
An XML description of the Flickr Services API. I built this semi-automatically by parsing the API description pages then sprinkling a few datatypes over it. You don't need this either, unless you want to rebuild the library files.
- flickr-test.xsl (and flickr1-test.xsl)
Simple test stylesheets that demonstrate the libraries.
- xslt.jar (or source)
A Java XSLT extension function for generating MD5 hashes. (Only needed to use services that require authentication.)
To use XSL Flickr, declare a prefix for the library namespace, import the library, define a global parameter for your API key and you're set to go. If you want to use services that require authentication, you'll also have to define global parameters for your shared secret and authentication token. (See Authentication.)
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 2 xmlns:f="http://www.flickr.com/services/api/" 3 exclude-result-prefixes="f" 4 …> 5 6<xsl:import href="flickr.xsl"/> <!-- or flickr1.xsl --> 7 8<xsl:param name="f:api_key" select="'YOUR-API-KEY-GOES-HERE'"/> 9<xsl:param name="f:shared_secret" select="'YOUR-API-KEY-SHARED-SECRET-GOES-HERE'"/> 10<xsl:param name="f:auth_token" select="'YOUR-AUTHENTICATION-TOKEN-GOES-HERE'"/> 11…
Each Flickr method
is implemented as a named template
with the parameters specified in the Flickr API. The
defaults to the global
and authentication uses the
$f:auth_token parameters. If the authentication parameters
are provided, they are used for all calls. This means, for example, that
you can exract information about your own private photographs.
Each template returns the XML structure returned by the API. In
XSLT 2.0, this can be accessed directly; in XSLT 1.0, you'll have to
put it in a variable and use
exsl:node-set to get at
For example, in XSLT 2.0:
1<xsl:variable name="user.rsp" as="element()"> 2 <xsl:call-template name="f:people.findByEmail"> 3 <xsl:with-param name="find_email" select="'email@example.com'"/> 4 </xsl:call-template> 5</xsl:varname>
$user.rsp to the result of
flickr.people.findByEmail method. In this
1<rsp stat="ok"> 2 <user id="24401095@N00" nsid="24401095@N00"> 3 <username>Norm Walsh</username> 4 </user> 5</rsp>
The user ID (among other things) can then be used in subsequent calls to get more information from the API.
Using named templates, instead of functions, does make access a little awkward, but it seemed like the best way to deal with the large number of optional parameters. In practice, it hasn't been too much of a burden.
XSL Flickr is maintained by Norman Walsh. Please report any bugs that you encounter.
XSL Flickr was first announced on 27 April 2005.
Some Flickr API services require authentication. Before Flickr was acquired by Yahoo, this was accomplished by providing a user name and password. The current authentication API is considerably more complex.
In order to use services that require authentication, you must have access to an XSLT extension function that can provide MD5 hashes and you must apply for (and obtain) your own API key. (It doesn't make any sense for an entire library to have a single key so I'm not providing one for XSL Flickr “out of the box”.)
After you've obtained an API key, follow the Flickr instructions for obtaining the authentication token for that key. It's a little tricky. In brief:
Edit the details for your key, providing a “Callback URL” that will show you the parameters passed to the URI. I used a simple CGI debug script.
Construct the login link and load it in your browser. That will redirect you to a Flickr page where you grant access to the application.
After you've granted access to your application, you'll be redirected to the callback URL you provided. From that, extract the “frob” that Flickr sends.
Finally, follow the instructions for converting the frob to a token and you're done.
Luckily, you only have to do this once. Armed with the key, the shared secret (shown on the page with your key), and the token, you can begin using authenticated services. The XSL templates will automatically do the MD5 hashing magic.
I've provided a Java extension function that does hashes. If you implement one for another processor, like xsltproc, you'll have to edit the library a bit. If you make the function available publicly, let me know and I'll integrate it into a future release.
This is the second release of XSL Flickr. The following earlier releases were made:
0.9, from 27 April 2005 was a beta release that supported the old (pre-Yahoo) form of authentication.