User Tools

Site Tools


transformation

Transforming Tasklists with Stylesheets

Tasklists can be rendered in different ways by using a Transform process. The ToDoList XML file (the .tdl file) is exported in a similar but different XML format. That intermediate document is then put through an XSL transformation using another file (called a stylesheet) with extension .XSL. So there is the source XML document, an intermediate XML document, the transformation process, the XSL that describes what to do, and the result in a final transformed document.

The most common transformation is to convert the data into HTML, usually a report for clients or management, though the output can be any text format including CSV or a custom format which can be imported by other applications. Sample XSL files are found in the installation folder under Resources\Stylesheets.

The Transform Tasklist dialog allows entry of a Title, which is a field added to the intermediate file. The Stylesheet .xsl file can be selected from the default folder or any other.

Task selection allows a subset of the entire tasklist to be exported into the intermediary file for transformation. You can Filter and/or Select desired tasks, and then come to this page to report on just those tasks.

The attribute selection allows for all possible fields to be exported, or specific fields can be specified to simplify the exported file. If the XSL is written to skip unrecognized fields then All attributes can be selected, but some XSL is more specific on exactly what it requires, so specific custom fields may be required.

On clicking OK, you are prompted for the location of the final transformed file. Select the folder and file name. The Save As Type is only used to display other files of the same type - it does not affect the format of the file that is saved.

A full explanation of XSL is beyond the scope of this wiki. Details of transforming ToDoList XML via XSL will be posted here as time permits. Until then a lengthy tutorial on the topic can be found here Comments and questions are welcome there.

The samples under Resources\Stylesheets can be viewed with any text/XSL editor and used as a guide for creating new transforms. Just copy one of those, edit, and then use your own version for your reports.

Contributions for new transform stylesheets can be posted to the Github repository.

Note that there is a Preference to “Automatically export after saving”. Specifying a stylesheet here will cause this transformation process to occur on every save operation. This allows you to publish the state of a tasklist to a website, network folder, or other location without manual effort.

Assigning XSL Stylesheet to XML Files

As stated above, during a Transformation, the .tdl XML file is exported to a temporary intermediate format, and XSL is then applied to that intermediate file. In v7.1 an enhancement was made which allows the .tdl file to preserve a reference to an XSL file. So if you would prefer to operate on the raw XML data you now have the option. For example, here is the top of a typical .tdl file:

<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="\tasks\resources\stylesheets\mystyle.xsl"?>
<TODOLIST PROJECTNAME="Huge Project" FILEFORMAT="11"
 EARLIESTDUEDATE="0.00000000" LASTMOD="42653.54420139"
 LASTMODSTRING="10/10/2016 1:03 PM" NEXTUNIQUEID="514"
 FILENAME="Huge.tdl" FILEVERSION="1956" APPVER="7.0.999.2">

The xml-stylesheet tag is added manually by you with any typical text editor. ToDoList does not use this in any way and the tag is not maintained in the ToDoList application. The enhancement was simply to prevent that line from being removed on update.

Since ToDoList ignores this line, there is no disadvantage to adding it, as long as you have XSL which operates on the raw .tdl file schema, which is similar to, but not the same as the intermediate file.

transformation.txt · Last modified: 2016/10/11 07:21 by editor