Desperate for xslt help!

Here should go questions about transforming XML with XSLT and FOP.
tmf132
Posts: 2
Joined: Sun Apr 06, 2008 4:39 pm

Desperate for xslt help!

Post by tmf132 »

Hi,

Firstly I am new to xslt. Like us all, a new project just got thrown on my lap and I need to have these reports by Tuesday morning. I just love my job. :lol:

I have a custom list that is in xml format coming from a SQL2005db. I need to do some filtering on this list.

I need to generate the following reports based on the data from this list:

1. Number of Customers for the year.
Within the record there is a field called 'Project Start Date'. I want to be able to filter against this date in displaying number of customers for a selected year. One of the problems I am having is truncating the date down to just filtering against the year and not the whole date/time string.

2. Percentage of customers based upon currency.
We have many customers who pay with differing currencies. I need to be able to display what percentage of customers are paying in any of the acceptable currencies.

I am new to xslt so any information or suggestions you can give me would be greatly apprecitated.

Also, if anyone knows of a link or resource that has a list of commonly used xslt formulas that would be great.

Sincerely,
Tim
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Desperate for xslt help!

Post by george »

Hi Tim,

I cannot give you any specific advise as you have not provided a sample input and an expected output.
First you need to decide if you can use XSLT 2.0 or not because it is much easier to do things in XSLT 2.0 than in XSLT 1.0.

The best resource for XSLT is the xsl list from Mulberry Technologies:
http://www.mulberrytech.com/xsl/xsl-list/index.html
You can browse/search the archives and post questions if you do not find your answers in the archives.
There is also an xsl FAQ created by Dave Pawson
http://www.dpawson.co.uk/xsl/sect2/sect21.html

For working with dates:
XSLT 2.0 has date support by providing a number of functions. In XSLT 1.0 you can use string functions to extract the year.

For finding the percentage you can count all orders and the orders with a specific currency and then get the percentage from these numbers.

Hope that helps,
George
George Cristian Bina
tmf132
Posts: 2
Joined: Sun Apr 06, 2008 4:39 pm

Re: Desperate for xslt help!

Post by tmf132 »

HI George,

Thank you for your reply! Never having worked with xslt before I wasn't sure what to provide.

Some insite:
The repository for this data is Microsoft SharePoint Server 2007. I am using Sharepoint Designer 2007 to actually create the report which has a utility to provide xslt filtering against a dataview webpart.

So I have the following bits of data:
Customer Name
Project Title
Project Start Date
Currency
Partners
Principals

So what I need is to be able to do is to create view that concatenates the date to display just the year and present the projects that occured during that time period.

Something like this:
Year: 2008
Number of Projects:
Year 2007
Number of Projects:

For the percentage report, I need to be able to filter the data so I can display the percentages of currencies to customers.

Sample report: Would like to make this into a bar graph.

Currency Report:
USD: 40%
INR: 14%
BPS: 30%
EUR: 16%

Thank you for any additional thoughts you may have.

Sincerely,
Tim
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Desperate for xslt help!

Post by george »

Hi Tim,

Sorry but I have no experience with Sharepoint Designer 2007.

Regards,
George
George Cristian Bina
kleb
Posts: 4
Joined: Fri Jan 18, 2008 10:11 pm

Re: Desperate for xslt help!

Post by kleb »

I would highly recommend the XSLT Cookbook 2nd ed published by O'Reilly. It has pretty much everything you need to get up to speed quickly and is task oriented. It has a section on dynamically creating graphs using SVG and XSLT.

Then when you need a reference, XSLT 2.0 by Michael Kay (he writes the Saxon xslt processor) will be good.
Post Reply