smelt
optionally pronounced sport smelt

SportsMLT: SportsML Transformation Library

SportsMLT is a companion XSLT library of scripts to render SportsML into other languages -- first and foremost being HTML.

SportsMLT is not affiliated with the IPTC, but is released under the GNU Public License here at SportsStandards.org.

Downloads (Beta -- see readme.txt file inside)

Development

A home on SourceForge.net has been established to aid the SportsMLT development community.

Tested Platforms

SportsMLT has not been tested for every XSLT engine out there. It has been developed and tested on:

  • Java: xalan-2.5.2 riding atop xercesImpl-2.6.0 (part of the Apache XML project)
  • Perl, PHP, Others: libxslt-1.1.2 riding atop libxml2-2.6.4 (part of the Gnome XML project)

A few errors with SportsMLT have been found when interpreted by the Sablotron engine.

Documentation

The top-level sportsmlt.xsl stylesheet file is the "mother stylesheet" that includes the rest of the xsl function library and where you will set several system variables.

After sportsmlt.xsl identifies the fixture (the term used to describe document-type) and league, it looks in this file -- /resources/fixture-formatter.xml – to see what template is assigned to it. Any time a new presentation template is created or a new fixture added to the content inventory, this file will need to be updated to make the transform work.

These are a series of xml-compliant templates –- in /templates/ -– that contain the html and .css markup. Embedded in them are a series of tags (example: <so:player-name/>) that, when processed by the function library, represent the SportsML data.

If you know HTML, you can easily rearrange the templates to make simple changes and restructure the existing data in a format you prefer. Or change the look by altering CSS tags.

The main stylesheet includes references to XSL function libraries that process many of the so: tags inside the presentation templates. The core file contains functions across sports, while sport-specific functions have their own file in the /functions/ folder.

Occasionally, the xsl functions perform lookups in files in the /resources directory. For example, one set of resource files stores team names and team keys (in /resources/teams). It is important to keep these up-to-date.

HTML markup in the template files allow you to make many cosmetic changes just by editing a companion CSS stylesheet. This is the easiest way to manipulate font sizes, table sizes and colors. The coding also allows you to customize display properties by sport.

  • SportsMLT's "template-driven" approach allows the user to assign different templates to different league-fixture combinations
    • An MLB Box Score (league-key=l.mlb.com and fixture-key=event-stats) can use the same template as the Box Scores for Minor League Baseball, but a different template from those used for NBA Box Scores
    • All templates are inside the templates/ directory
    • The file named resources/fixture-formatter.xml is the "lookup file" for which template to use for which league-fixture combo
    • The functions/ directory contains files that define all the functions that can be included within our template language
  • The resources/abbreviations.xml file contains abbreviations for statistics that can be used to create short Column Headers
    • For example: Average Yards Per Reception, with the SportsML attribute of "receptions-average-yards-per," can be shortened to "YD/REC"
  • The resources/teams/ directory contains league-specific lookup tables that can be used to store aliases (shorter names, nicknames) for the various teams in those leagues
  • The sportsmlt-header-footer.xsl file contains the common header and footer that gets applied to every rendition.
    • Different templates can call in different header or footer blocks, if you'd like
    • Headers and footers can also include some common document values, such as document titles and basic metadata.
  • Read the included readme.txt file to learn how to adjust the configuration settings found in the main sportsmlt.xsl driver file.
  • SportsMLT outputs HTML using "class" attributes, so that refined styles can be applied using a CSS stylesheet. Download the CSS above, modify it to match your desired look-and-feel, and refer to that CSS file atop your template that frames the HTML produced by SportsMLT.