Documented an example of a custom annotation query and XSLT transform

In the process, fixed a lot of bugs that made this functionality
broken. All example code in doc/ should be testable like rfcs.py