If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Tuesday, November 29, 2011

Higher order declarative XML and dynamic XSLT

I've been playing with the idea that when you hook a few advanced technologies together you could build some nice stuff. The things that came to my mind are:
  • playframework 2.0
  • Scala
  • Apache Cocoon 3.0
  • latest version of saxon
  • a Database to store application resources (XSLT, templates, images, ...)




The idea I had in mind was to create reusable widgets and I've been reminded today that such things are already in the market. However, it's hard for me to compare ease of use, performance and usability for commercial businesses. In the meantime I started experimenting a bit and came up with the following widget which basically generates the same output (table containing tweets for particular person) as in my previous article. However, in the previous article no higher order XML declarations were used. I think you will see that with some XSLT magic you get a lot done with a few lines. It took some time to get it working properly but the table widget now takes an @data-source which you can bind to any table:component.

By the way, with higher order declarative XML i am referring to the analogue higher order functions like e.g. MAP / REDUCE, FOREACH. As you can see from the sample below, a single table:row instruction can actually be seen as a function which maps a sequence (of nodes selected with the @bind) to table:rows.

The complexity about getting the widget below to work was thinking out-of-the-box: Generate a XSLT on the fly using XSLT which would do all the heavy lifting.

No comments:

Post a Comment