Generate a Microsummaries Generator

microsummarygenerator.user.js - Install Greasemonkey User Script.

Among the many new features of Firefox 2.0, there is one called Microsummaries. Also known as "Live Titles", which I think more accurately describes what it's all about: a bookmark that shows the latest key information from the target website.

The live bookmark feature can be created by the site owner, by adding a specific link to the current web page. Or by anyone else, by defining a simple XML file around an XPath query, to select the relevant headline element. This XML file is called a Microsummaries Generator.

Now figuring out the whole XPath string can be a annoying task, especially counting the number of nested divs, table rows and such. To alleviate this, Greasemonkey comes to the rescue with the microsummarygenerator.user.js user script.

Quick walkthrough

Steps to generate the Generator XML:

Example XPath selector panel

/html/body /ul[3]/li[3]/a

Installing the generator XML

This is less simple in Firefox 2.0b1, could not erally find an option for easy installation of the Generator XML. However, the following appears to work:

Example, for slashdot.org (talking about terrible html markup...), after selecting the top headline, the following XML is generated:

<?xml version="1.0" encoding="UTF-8"?>
<generator 
	xmlns="http://www.mozilla.org/microsummaries/0.1"
	name="Microsummary for Slashdot: News for nerds, stuff that matters">
 <pages>
   <include>^http://slashdot\.org/</include>
 </pages>
 <template>
   <transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <output method="text"/>
     <template match="/">
       <value-of select="normalize-space(string(//div[@id='articles']/div/div/div/h3/a))"/>
     </template>
   </transform>
 </template>
</generator>

Greasemonkey 0.6.4 and Firefox 2

You can not install the current version (0.6.4) into Firefox 2.x, however, there's a work around. Head over to Greasemonkey for Firefox 2.0 beta.

Changelog

Version 1.10
	- improvement: user interface to choose between using
	  an element's ID as start point, or simple XPath components

Version 1.02
	- fix: escape chars in title (now for real)
	- fix: use ID attribute if selected element has one
	- enhancement: stop events after generating XML

	TODO: user interface to choose between ID's or absolute XPath

Version 1.01
	- fix: escape chars in title

Version 1.00
	- initial release
$Id: GM_Microsummaries.html 52 2006-07-22 07:58:31Z joe $

About Greasemonkey

Greasemonkey is a Firefox extension, which can change web pages by applying cleverly crafted user scripts after they are loaded in the browser.

Tip! Greasemonkey Hacks by Mark Pilgim.

More Greasemonkey User Scripts

For more, and a couple of Greasemonkey resources, see Greasemonkey User Scripts.