Using mdfind2+XSLT to display Spotlight search results in NetNewsWire
Toxic Software's excellent Mac programmer has created a nice tool for doing a search using Spotlight - and getting the results in a nice repurposable XML format.
Then, to make it accessible from NetNewsWire, a friendly-yet-powerful RSS/Atom feed reader I own and like a lot, he wrote an XSLT script to convert search results from his XML format to standard Atom format.
Then, he provided a shell script that invokes the search and pipes it through the XSLT transformer using a standard XSLT transformer.
Toxic Software (Blog):
this little gem. mdfind2 is a replacement for Apple%u2019s mdfind command line tool. This version adds one feature that mdfind doesn%u2019t have, you can specify the --xml switch on the command-line to output the results (including full attribute values) in XML
This is great stuff. I honestly find it refreshing to see that the programs-as-components and filter-pipelines ideas that Unix promulgated in the 1970s and 1980s has not died or reached a plateau. It is still growing and becoming more powerful on platforms like Linux and now the Apple Macintosh.
Whereas in the 1980s, people would have been perfectly content with a text-based user interface for something like this, in 2006 bolting the search output to a GUI display is no problem.
Pipelines are one of my favorite architectural design patterns. Combined with layering, they are powerful tools for solving complex problems with solutions built out of simple components.
0 Comments:
Post a Comment
<< Home