Home / XSLT

XSLT Tools
Download XSLT Tools


SourceForge.net Logo
 

WURFL XSLT Tools
by Roland Guelle

The WURFL information is stored in XML. So the simpliest way to manipulate and transformm WURLF is XSLT.
If you have ideas or own XSLT, your help is welcome :)

These stylesheets are tested with xsltproc from the package libxslt. I only use this on the command line, if you need a GUI - there are lot of tools that helps you working with XSLT.
Some exslt extensions are used, so please check if your XSLT processor supports this.

If you have never worked with a XSLT processor or the command line before, add to WURFL and open the file with Firefox.

Available XSLTs

  • patch_wurfl.xsl
    Patch WURFL with your own devices, groups and capabilities.
    Example:
    run: xsltproc --stringparam 'file' "your_patch_file" patch_wurfl.xsl wurfl.xml > wurfl_patched.xml
    If you like to format the output (with xmllint):
    run: xsltproc --stringparam 'file' "your_patch_file" patch_wurfl.xsl wurfl.xml | xmllint --format - > wurfl_patched.xml
    If you like to format the output (with tidy):
    run: xsltproc --stringparam 'file' "your_patch_file" patch_wurfl.xsl wurfl.xml | tidy -config tidy_config - > wurfl_patched.xml

  • check_wurfl.xsl
    Checks your patched/modified WURFL consistency if:
    • id attribute is present and unique
    • user_agent attribute is present and unique
    • fall_back is available and could be resolved

    Example:
    run: xsltproc check_wurfl.xsl wurfl.xml

    • roll out XSLT
      Resolve WURFL fallbacks for all values and capabilities defined in roll_out_capabilities.xml.
      Check the parameters in the XSLT for more options.
    • roll_out_into_txt.xsl
      Create text (maybe CSV compatible) version of WURFL.
      Example:
      run: xsltproc roll_out_into_txt.xsl wurfl.xml > wurfl.txt
    • roll_out_into_xml.xsl
      Create a flat WURFL version, with each capability as device attribute SQL.
      Example:
      run: xsltproc roll_out_into_xml.xsl wurfl.xml > flat_wurfl.xml
    • roll_out_into_sql.xsl
      Create SQL statements for insert WURFL into a SQL database.
      If you like, you can also generate the create statement with this script (default).
      Example:
      run: xsltproc roll_out_into_sql.xsl wurfl.xml > wurfl.sql

  • remove_elements.xsl
    WURFL lists many capabilities and groups. If you don't need each of these elements, you will find this tool really useful.
    Create a small XML listing the unwanted groups, run the XSLT and you'll get a new WURFL without the groups and the capabilities that you have selected. This should help you keep WURFL smaller and make your applications faster.
    Example:
    edit remove_elements.xml
    <?xml version="1.0" encoding="UTF-8"?> <elements> <groups> <group>wta</group> <group>object_download</group> <group>streaming</group> <group>wap_push</group> <group>j2me</group> <group>mms</group> <group>sms</group> <group>sound_format</group> </groups> <capabilities> <capability>tiff</capability> </capabilities> </elements>
    run: xsltproc --stringparam 'file' "remove_elements.xml" remove_elements.xsl wurfl.xml > clean_wurfl.xml


Some (maybe) outdated stylesheets:
  • get_capabilities.xsl
    Get capabilities without groups from WURFL for selected user agent.
    Example:
    run: xsltproc --stringparam 'ua' "Nokia3650" get_capabilities.xsl wurfl.xml

  • convert_wurfl_markups.xsl
    Convert the WURLF markups to the 'old' names.
    The markup names have changed from wml11 to wml_1_1 standard.
    If you don't want to change your application, you can use this XSLT to transform the names into the old format.
    Example:
    run: xsltproc convert_wurfl_markups.xsl wurfl.xml > wurfl_converted.xml

  • count_useragents.xsl
    Answers your question "how many useragents/capabilities are stored in WURFL?"
    Example:
    run: xsltproc count_useragents.xsl wurfl.xml

  • convert_2_html.xsl
    Create an HTML page from the WURFL.xml
    Example:
    run: xsltproc convert_2_html.xsl wurfl.xml > wurfl.html

Copyright © 2007-2009, Luca Passani