Can I get down now dad?

Tramps like us, baby we were born to code

Converting the WURFL to SQL

The WURFL is getting a bit of a whopper these days but it is surprisingly easy to convert it all to a SQL table.

Download the WURFL and then go get the handy XSLT Tools.

Converting the WURFL to a pile of inserts is as simple as:
xsltproc roll_out_into_sql.xsl wurfl.xml > wurfl.sql

By default this only adds a few capabilities but you can add loads more by adding them to the roll_out_capabilities.xml file.

After all this you get:


.
.
insert into wurfl_devices
(id,user_agent,preferred_markup,model_name,brand_name,resolution_width)
values ( 'nokia_n81_ver1_sub310035', 'NokiaN81-3/10.0.035 UNTRUSTED/1.0', 'html_wi_oma_xhtmlmp_1_0', 'N81', 'Nokia', '240');

insert into wurfl_devices
(id,user_agent,preferred_markup,model_name,brand_name,resolution_width)
values ('mot_v9m_ver1_subopwv','MOT-V9m/1.1 UP.Browser/6.2.3.4.c.1.123 (GUI) MMP/2.0', 'html_wi_oma_xhtmlmp_1_0', 'RAZR V9m', 'Motorola', '240' );
.
.

This is all jolly handy but I can’t stop being slightly appalled by the syntax of XSL. Like all declarative languages once you go over a level of complexity they become pretty tricky to read and maintain. They often seem to introduce half baked procedural bits which make it worse. Sigh.

Leave a Reply