XQuery
Wow, is XQuery cool... I'm looking now at making sites I run to be more accessibility friendly and I wanted to extract all of the official checkpoints so that I could reorganize them in a way which I feel would be more useful to developers (more by type, e.g., having all relevant concerns grouped under "language", "images", "forms", "tables", etc.). While regular expressions might have done the trick (another technology which should be taught to high school students, along with XQuery, imho), I liked the greater predictability of working with XQuery.
With my XqUSEme Firefox extension, I was able to XQuery the current window in Firefox (i.e., the accessibility page) and perform the following pretty straightforward query (if you know XPath) to get the results:
which returned results such as this:
Pretty neat...
addendum: Well, I see the above XQuery is a little too simplistic. While the text() node test does avoid the link I didn't want to copy, it also manages to fail to grab the inner text of some other elements such as <em> which I did want to grab. I suppose I should just use string() and use regexp to remove the preceding numbers or investigate whether XPath 2.0 can deal better with text nodes and then apply that... Anyways, it's all still cool...
addendum2: Looks like I should have researched more carefully. There already is an official page with the items organized by element type: http://www.w3.org/TR/WCAG10-HTML-TECHS/
With my XqUSEme Firefox extension, I was able to XQuery the current window in Firefox (i.e., the accessibility page) and perform the following pretty straightforward query (if you know XPath) to get the results:
<html><body> {
for $dt in doc('XQuseMeContainer.dbxml/mytest.xml')//dt[@class='checkpoint']
let $url := 'http://www.w3.org/TR/WAI-WEBCONTENT/'
return <p><a href="{$url}#{$dt/span[@class='checkpoint']/a/@name}">{$dt/span[@class='checkpoint']/a/string()}</a> {$dt/text()} } </body></html>
which returned results such as this:
5.5 Provide summaries for tables.
5.6 Provide abbreviations for header labels.
6.1 Organize documents so they may be read without style sheets. For example, when an HTML document is rendered without associated style sheets, it must still be possible to read the document.
Pretty neat...
addendum: Well, I see the above XQuery is a little too simplistic. While the text() node test does avoid the link I didn't want to copy, it also manages to fail to grab the inner text of some other elements such as <em> which I did want to grab. I suppose I should just use string() and use regexp to remove the preceding numbers or investigate whether XPath 2.0 can deal better with text nodes and then apply that... Anyways, it's all still cool...
addendum2: Looks like I should have researched more carefully. There already is an official page with the items organized by element type: http://www.w3.org/TR/WCAG10-HTML-TECHS/