first, a bit of javascript code to obtain a list of named stylesheets linked to an html web page. it uses several prototype functions to streamline the code, and to address any browser quirks in getAttribute(). and since we’re particularly interested in the title, we actually build a list of anonymous objects, each of which contains both a stylesheet link element and its title attribute.

  function list_stylesheets () {
    return $$('link').select(named_link).map(link_meta);
  }
  function named_link (link) {
    return (link.readAttribute('rel').indexOf('style') != -1
      && link.readAttribute('title'));
  }
  function link_meta (link) {
    return { 'link': link, 'title': link.readAttribute('title') };
  }

on to part 2…