This post by Les Orchard prompted me to think about how I'm increasingly relying on XSL transformations for much of FeedDemon's UI. For example, every FeedDemon newspaper relies on transforming RSS, and the new subscription overview in FeedDemon 2.0 is generated by transforming the OPML file containing your subscriptions. For a live demo of this, take a look at these three files:
- subscriptions.xml - this is the "raw" OPML file (not transformed)
- subscriptions.xsl - this is the XSL file used to transform the OPML
- subscriptions-t.xml - this is the same OPML file with the XSL applied to it (note that hyperlinks will fail since they use an
fdaction
protocol that only works inside FeedDemon.)
I hadn't worked with XSL prior to creating FeedDemon, so the newspapers in the very first version of FeedDemon were sort of ugly, and they took ages for me to create. After all, I was used to object-oriented programming, not the strange world of XSLT. Learning XSLT wasn't a whole lot of fun, either. It's an odd language with unexpected omissions, bizarre rules and a learning curve that's made steeper by unexpected "gotchas" - in other words, it's just like every other language out there.
I still feel like a beginner with XSL, but I grok its power now that I've used it for a while. The ability to create a friendly, web-like user interface by transforming XML documents is definitely handy, and in some ways I find it simpler than "traditional" GUI development since I can make huge design changes with a few lines of XSL without having to re-arrange a dialog full of widgets.
What a great demonstration of the power of XSLT. I think Les has some of the best technical ideas around.
Posted by: Anne Zelenka | Monday, March 06, 2006 at 02:44 PM
Welcome to this world! A couple of years ago I wrote a half-assed application to create small websites. It was very similar in concept to FogCreek's CityDesk, but I wrote it a couple of months before. Anyways, it uses XSLT; my homepage (in spanish, sorry) uses it to magically generate a calendar. I even wrote a how-to (in spanish again, sorry): http://tech.epublish.cl/articles/epublish_20020917203416.html
Ouch, this was back in 2002. Heh. Obviously, my app went the way of the dodo, but I still use it to update my weblog. I wrote it in Delphi, by the way :-)
Posted by: Leonardo Herrera | Monday, March 06, 2006 at 03:02 PM
Yeah...XSLT sucks to learn especially if you're doing complicated transformations.
One good source I use frequently is:
http://www.dpawson.co.uk/xsl/index.html
Posted by: Jon-Paul LeClair | Monday, March 06, 2006 at 04:29 PM
Nick, it was from hacking at the Newspaper XSL transformations in FeedDemon that I was introduced to XSLT. I've learned a lot just by looking at your XSL stylesheets.
Posted by: Dan MacTough | Monday, March 06, 2006 at 05:13 PM
Anne: Modesty compels me to point out that that use of XSLT with OPML wasn't created by me. :)
Nick: You know, FeedDemon is one of the few apps that makes me sometimes wish I used Windows more often.
Posted by: l.m.orchard | Monday, March 06, 2006 at 08:29 PM
Very cool, Nick. Do you have any recommended books/resources on XSLT?
Posted by: Brian | Tuesday, March 07, 2006 at 08:58 AM
This is a topic that I'm just starting to investigate, and I have a beginner's question.
What is the actual process of invoking an xslt to say an opml file? Do you link to the xsl from within the opml file?
I've found some sample transform stylesheets, and have an opml file...but am missing the 'connection' point...thanks
Mark
Posted by: Mark Woodward | Tuesday, March 07, 2006 at 10:37 AM
Dan: that's great that FeedDemon's newspapers helped you learn XSL!
Brian: O'Reilly's "Learning XSLT" is probably a good book to start with. I recommend coming up with a non-trivial task you want to perform with XSL and then simply doing it. Even if it's hard and takes a while, you'll learn a lot in the process.
Mark: Do a "view source" on the subscriptions-t.xml file linked above - you'll see that it contains an ?xml-stylehseet instruction near the top which links the XSL.
Posted by: Nick Bradbury | Tuesday, March 07, 2006 at 11:33 AM
The latest version of Dreamweaver does non-complex XML transformations. Good enough for many RSS and OPML. There is a steep price to get Dreamweaver, but if you own it, you can learn XSLT that way.
Posted by: Ray Daly | Tuesday, March 07, 2006 at 06:44 PM
Nick -- looks as if Apple has applied for a patent for some stuff that's already part of Feeddemon -- you should have your legal people take a look.
(link from Dave Winer's weblog)
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-adv.html&r=1&f=G&l=50&d=PG01&p=1&S1=20050289147.PGNR.&OS=DN/20050289147&RS=DN/20050289147
Posted by: mike | Wednesday, March 08, 2006 at 05:14 AM
Nick:
The nice thing about XSLT is that it is easier for us as users to customize our experience by adjusting the code as desired to apply our own favorite color schemes, etc...
No complaints here!
--Russ
Posted by: Russ W | Wednesday, March 08, 2006 at 12:45 PM
I'm trying to get this to work...and I just clipped out the part of Nick's file that referenced the transform, and changed the url...but I get the following error:
Invalid syntax for an xml declaration. Error processing resource 'http://bubbacon.com/xsl/ctapi.xml'. Line 2, Position 1
Posted by: Mark Woodward | Saturday, March 11, 2006 at 02:25 PM
Mark, the problem is that ctapi.xml's XML declaration isn't closed.
Posted by: Nick Bradbury | Sunday, March 12, 2006 at 09:46 AM