2009-02-15

XSLT on VersionOne

I've been using XSLT a little more recently. Our team uses VersionOne for project management. VersionOne has a REST API, which allows you to develop new tools that can utilize the data from the project management tool. This allows for retrieving data for reporting purposes as well as being able to post new content, such as adding stories, tasks, logging efforts, etc.

Not only does VersionOne have read access to all of the different "Assets" that are configured in the system, but it also allows you to provide an "xsl" request parameter to the URL, and it will automatically apply a transformation on the returned XML, using a stylesheet that resides on the server. My current objective is to use the VersionOne XSLT and REST capabilities to create a weekly timesheet. In order to do this, I must create a URL for the REST API that can return all the "Actuals" for a particular person and date range. The URL I came up with looks like the following: 

http://<host>/<v1 instance>/rest-1.v1/Data/Actual?sel=Value,Timebox.Name,Workitem.Name,Workitem.Parent.Name,Date,Scope.Name&where=Member.Username=hickman;Date>='2009-02-12'Date<='2009-02-12'

 The URL above will return all "Actual" assets (or "effort" entries) for the user "hickman" and between the dates 2009-02-12 and 2009-02-27 (inclusively). You may also notice the "sel=" parts. This allows you to narrow down the data items you retrieve. This reduces the load on the REST service and allows you to get the parts you actually need.

 The data comes back in a flat data structure, similar to the following:

<asset href="/VersionOne/rest-1.v1/Data/Actual/24193" id="Actual:24193">
<attribute name="Value">2</attribute>
<attribute name="Workitem.Parent.Name">Story 1</attribute>
<attribute name="Scope.Name">Project 1</attribute>
<attribute name="Date">2009-02-12</attribute>
<attribute name="Timebox.Name">Iteration 1</attribute>
<attribute name="Workitem.Name">Coding</attribute>
</asset>


The problem with the flat data structure is that I would like to display the information in a hierarchical fashion. Since this is project management data, then it may make sense to show it as:

Iteration 1
Project 1
Story 1
Task 1
Task 2
Story 2
Task 3
Project 2
Story 3
Task 4
Iteration 2
...
Some of the functionality I need, however, isn't supported by the currently installed XSLT library. VersionOne is a .NET application, so it's using whatever is installed by Microsoft IIS. It'd be great to be able to use the XSLT 2.0 functionality such as xsl:for-each-group. I've even tried using the Muenchian Method for grouping in XSLT 1.0. From what I can tell, however, this works well for a single grouping, but I need more complex grouping than this.

While doing my research on this subject, I came across EXSLT (XSLT extensions) as well as some of the SAXON extensions. Both of which would need to be supported by the IIS XSLT library.

I think for the time being, I'll just output the data structure in Javascript, and do the heavy lifting there. It's not ideal, but I don't want to spend a massive amount of time on the subject.

No comments: