xmllint and xsltproc

I've been recently developing XSL transformations. I've been implementing C++ code to edit XML files using XPath values too.

I had previously used xsltproc, the command line utility distributed together with libxslt to test and debug my XSL transformations.

I have also used xmllint to validate hand-written XML files in order to be both well-formed and valid against a given DTD or XSchema.

But I recently discovered a wonderful xmllint feature: the --shell option. It runs an interactive shell that allows the user to navigate within the XML document as in a file system. But navigating is not the most useful feature I found for the shell option: it's the xpath command.

It allows to quickly check what node-set will be obtained when applying an XPath expression to a given XML input file.

It's a really useful utility when writing complex XPath expressions or checking out results for XPath expressions on complex documents.


Wikileaks: shooting the messenger

Bruce Schneier states some extremely sane and reasonable points on the Wikileaks diplomatic cables leak case.

License vs. HTML/Javascript Gadget

So I've been customizing my blog a little by adding some gadgets. That's how I got to know about the HTML/Javascript Gadget - provided by Blogger - allowing to add user provided HTML/Javascript code. So at first I thought it made the License Gadget I developed kind of useless.

I tried the HTML/Javascript Gadget and configured it using the CC provided code for a by-nc license and this is how it looked on this blog:

The License Gadget looks like this:

So text and image are not centered in the raw CC provided code, which would require user customization of the HTML code. On the other hand, style sheet settings are respected. So at some point I'll have to search out how to achieve it.

So I was happy to realize that my effort on developing the License Gadget were not only useful for learning (which was a primary reason to do it) but it actually provides some additional value over the HTML/Javascript Gadget.


License Gadget

In the last post, I wrote down the reasons for my choice of a Creative Commons By-Nc license. This post is about the details on how I managed to place the license text in the blog.

I checked the Creative Commons site (CC) to look up license types and details and found out - as I was expecting - that the site offers the service to generate the HTML code to be inserted into a web page in order to display a license text and link to the Commons Deed provided by CC.

Once I had the code for the license I chose I googled for instructions on how to publish the license text into a Blogger blog. All the information I found was either staled (talking about setting options which are no longer available) or suggested to manually edit the blog template.

I checked the blog settings provided by Blogger and tried to paste the license HTML code into the text box left for customisation of the 'Attribution' blog footer section.

It turned out that text size limit does not admit to include the whole license code. So after experiencing a slight frustration feeling I figured out there might be a Google Gadget to display the blog license, since Blogger seems to set up the blog layout based on Gadgets.

I found none and thought that it might not be too hard to create one that just displayed the copy/pasted license HTML code. So I decided to create my first Google Gadget. I found all the information I needed at the Google gadgets.* API Developer's Guide.

My knowledge on HTML, CSS and Javascript was quite forgotten. It's never been too much anyway, I just learned the basics in college. So I had to check out a couple of online tutorials.

First and more surprising issue I encountered was that I couldn't get the Google Gadget Editor (GGE) to work properly on the Chromium browser! Somehow, weird invisible characters were being inserted/removed when I saved changes so the Gadget's XML code failed to be parsed. So after a while trying to figure out what was going on, I gave up and assuming my perplexity, I tried out Firefox and it worked perfect.

Then I had issues dealing with Javascript code errors, which are annoyingly silent for someone like me, since I'm used to work with compiled languages and have that really nice help that are compiler errors.

But after struggling with the new development environment (GGE), languages with which I'm not familiar, and a tough testing environment (Google Gadget Checker helped), I finally managed to get a basic Google Gadget that displayed a Creative Commons license text and links. The Gadget allows the user to chose the kind of CC license to display. You can see how it looks at the bottom of this page.

I have submitted it to the Google Gadgets directory and it might be available there at some point. Meanwhile, it can be included in any Blogger blog using this URL: http://hosting.gmodules.com/ig/gadgets/file/115386175924349751853/cc.xml.

You can also include it in any webpage (not necessarily a Blogger blog) clicking here.