Building your own Microsummaries Generator in XML for the new Firefox 2.0 (beta 1) can be a daunting task.
Figuring out the whole XPath string can be an annoying experience, especially counting the number of nested divs, table rows and such. To alleviate this, Greasemonkey comes to the rescue with my Microsummary Generator user script.
The general idea is that you start the script on your target page. Then you all individually discernible elements on the page will be highlighted when you move the mouse over the (just like for instance DOM Inspector). When you click the desired element, the script generates the proper Microsummaries Generator XML document for this element.
Determining the XPath for the Microsummary headline is currently done with these simple rules in mind:
Calculate the full XPath location path, down to the document root element (html). This results in a full nesting of named elements, indexed by their position if not the first of the same kind. Example:
/html/body/div/div[2]/table/tr[3]/td[2]/a
If an element has an ID attribute, take this as the starting point. Example:
//div[@id='stats']/span[2]
The general idea is that an “id’ed div” bears more semantic meaning, as intended by the website architect, and as such is much more likely to survive (minor) design and markup changes.
This, however, fails whenever an ID is generated for some other reason, like the title elements of this weblog (id=”post-31″). I have no solution for this yet, but I’m considering some user interface solution like this:
/html/body/div/div[2]/table/tr[3]/td[2]/a
| | | | |
| | | | +- ( ) id='id2e7f2ab'
| | | +------- (*) id='statstab'
| | +-------------- ( ) id='stats'
| +------------------ ( ) id='main'
+----------------------------- ( ) use root element
Description: every element, which has an ID attribute, can be selected as the root of the XPath expression.
So the current version of the script has a few rough edges and there are still many manual steps needed in order to get the resulting XML Generator properly installed into Firefox. Be sure to share your thoughts for improvement!
Hoe werkt dat protest in het stembureau, hoe kan ik dat doen bijv. ?
Moet ik vooraf ook nog iets doen, zoals een vergunning of brief aan stembureau/gemeente of zo?