Using XSLT to extract content from your Unitrunker files

Home

Unitrunker stores and exports data in XML. The idea here is to use a very powerful tool for data extraction from XML. XSLT output is not limited only to XML or HTML. You can use XSLT to output comma delimited text. Some implications are:

This sample stylesheet extracts talkgroups as comma delimited text. To keep things simple, the sample provided will only operate on the first system it finds in the XML source file.

View the output file extracted.txt in notepad or open the file in your favorite spreadsheet program.

Unicode

msxsl produces UTF-16 Unicode files. Notepad and Excel recognize this text format. msxsl depends upon a recent version of MSXML. If you've a recent version of Internet Explorer, you have it.

Mac and Linux

The command line equivalent for msxsl.exe is xsltproc. The syntax is slightly different in that the placement of stylesheet and XML file are reversed so the above example would read:
xsltproc groups.xsl system.xml -o extracted.txt.

Improvements

The above sample extracts only talkgroups for the first system. Write your own transformation file to extract sites, channels, or groups from any system in the Unitrunker.xml data file. You'll find a tutorial on the subject here.

© Copyright 2009 Rick Parrish