Tony Bowden's Radio Weblog:
Updated: 03/05/2002; 15:16:59.

 

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

16 April 2002

Is your name in the first 4 billion digits of pi?

Lightweight XSLT with TT

I discovered a wonderful Template Toolkit plugin yesterday: XML::Style.

The basic idea, according to the docs, is that you can apply various attributes to your HTML. The example given is of transforming an HTML table:

           [% USE xmlstyle
                  table = {
                      attributes = {
                          border      = 0
                          cellpadding = 4
                          cellspacing = 1
                      }
                  }
           %]
    
           [% FILTER xmlstyle %]
           <table>
           <tr>
             <td>Foo</td> <td>Bar</td> <td>Baz</td>
           </tr>
           </table>
           [% END %]

This didn't sit quite right with me though, as that seemed to be something you should be doing in CSS. But as I read through the docs I discovered you can also change tags. Again though the docs gave a bad example:

           [% FILTER xmlstyle
                     th = {
                         element = 'td'
                         attributes = { bgcolor='red' }
                     }
           %]
           <tr>
             <th>Heading</th>
           </tr>
           <tr>
             <td>Value</td>
           </tr>
           [% END %]

Having been playing with XSLT recently, though, a lightbulb went off. The real power of this plugin is more to be able to do things like:

   [% USE xmlstyle
        video = {
          pre_start = '<html><head><title="Video Info"></head><body>'
          element = 'table'
          attributes = { class='videoTable' },
          post_end  = '</body></html>'
        }
    
        title = {
          pre_start = '<tr><td>Title:</td>'
          element    = 'td'
          attributes = { class='videoTitle' }
          post_end  = '</tr>'
        }
    
        price = {
          pre_start = '<tr><td>Price:</td>'
          element    = 'td'
          attributes = { class='videoPrice' }
          post_end  = '</tr>'
        }
   %]

And then, given some XML such as:

    <video>
      <title>La Double Vie De Veronique</title>
      <price>10.99</price>
    </video>

We end up with:

    <html><head><title="Video Info"></head><body><table class="videoTable">
      <tr><td>Title:</td><td class="videoTitle">La Double Vie De Veronique</td></tr>
      <tr><td>Price:</td><td class="videoPrice">10.99</td></tr>
    </table></body></html>

This could be used as a first step towards "true" XSLT if you're already using TT. If the only reason you're moving towards XSLT is because a PHB says to, it might even be enough to convince them that you've done so :)


How To Use Radio

Scott Johnson is not a moron. I must be. I had exactly the same problem as him, but never solved it. As I said to Dave Winer at the time: "I'm obviously missing something really obvious here..."

But, I've changed my mind. It's not at all obvious. "Choose the Open command from the File menu in the Radio application". I never dreamt that "the Radio application" has to be launched through right-clicking in your status tray. I had noticed the Radio icon, but double clicking it merely brought a webbrowser to the fore. Like Scott I assumed that the Radio application was browser based. And I just could not find that menu. Unlike Scott I gave up.

I tried subscribing to the help list first, but it's terrible. Every mail comes from the same address, and the first 30 character of the subject are taken up by "[radio-userland] New Message: ". In my mail client that means I only get about 5-10 characters of real subject line context. And each message is really just to let me know that "a new message was posted" to the help board, so there's no "In-Reply-To" headers, or anything that will let my mail reader thread the messages. Basically the list is unreadable.

So, then I gave up.

I suspect most users won't even get as far as I did. There is indeed a fundamental conceptual disconnect with how Radio portrays itself. I like outliners, and wanted to find the one in Radio - but not enough


More Drag and Drop

Scott Andrew has a nice drag and drop window demonstration. Unfortunately there's a nasty bug where Mozilla can't drop the box, but the concept is good. There's lots of little loose ends that he's tossing out for other people to fill in, which is good too. This is already very neat, but it could be exceptional when it gets fleshed out a bit more.


© Copyright 2002 Tony Bowden.



Click here to visit the Radio UserLand website.

 


April 2002
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Mar   May