Okay, in the Netherlands we have three kinds of VAT tariffs. None, low (6%) and high (19%). I also have an XML file with the following structure:
+ Invoice
++Article
+++Name: string
+++Amount: Integer
+++Price: Float
+++VAT: Enumeration (None, Low, High)
Thus it's a list of articles ordered with detailed information about how much was ordered and what it costs.
Now I need a SINGLE stylesheet that will transform this nice XML file into a nice HTML invoice page, showing:
1) a table of the articles ordered. (Name, amount, price, VAT and amount*price*tariff[VAT])
2) the total of all amounts split by tariff
3) the total amount of the whole invoice.
So, example, if someone ordered this:
Wine, 3 bottles, $5 per bottle, low VAT
Napkins, 5 packs, $1 per pack, high VAT
Screws, 100 pieces, $0.01 per screw, no VAT
then creating step 1, the table, is quite easy. Just walk through the file and select the proper values, using a choose on VAT to determine the proper multiplication for the total page.
However, the total per VAT percentage is bugging me. And so does the grand total.
At this moment I have something that will generate the grand total but it does this by creating a small piece of Javascripting so the totals are calculated client-side. However, I need this to be calculated serverside since the user might not allow any scripting.
A sample of what I have so far can be found at
http://www.workshop-alex.com/Bonnetje/Bonnetje.xml and
http://www.workshop-alex.com/Bonnetje/Bonnetje.xsl and the schema is found at
http://www.workshop-alex.com/Bonnetje/Bonnetje.xsd while you can also access
http://www.workshop-alex.com/Bonnetje/Bonnetje.asp if you want to retrieve the transformed HTML page. For those who are unfamiliar with the Dutch language, here some translations:
Bonnetje=Invoice, Naam=Name, Aantal=Amount, Prijs=Price, BTW=VAT, Totaal=Total, Geen=None, Laag=Low, Hoog=High, Datum=Date
The testdata is Dutch too but quite boring actually. It's my grocery list. :-) However, it gives an indication of what I'm trying. Keep in mind, however, that the grand total is pretty important but I'm more interested in the price pet VAT!