Transforming XML data into SVG line charts using XSLT
843834Jan 18 2003 — edited Jan 21 2003Hi
I am trying to transform revenue data from an XML file into an SVG line chart. The problem is that I am quite new to XPath and XSLT and whereas I can draw the grid for my chart I struggle drawing the lines using the data from the XML doc.
The XML look something like the one below, and I would like to have one chart for each product and in each chart having the time on the x-axis and chart the revenue by regions.
Any help on this is much appreciated.
Thanks
Peter
<?xml version="1.0"?>
<revenue>
<caption>
<heading>My title</heading>
</caption>
<date name="01/01/2003">
<region name="Asia">
<product_a>30</product_a>
<product_b>12</product_b>
<product_c>301</product_c>
</region>
</date>
<date name="02/01/2003">
<region name="Asia">
<product_a>32</product_a>
<product_b>12</product_b>
<product_c>301</product_c>
</region>
<region name="America">
<product_a>57</product_a>
<product_b>31</product_b>
<product_c>457</product_c>
</region>
</date>
<date name="03/01/2003">
<region name="Asia">
<product_a>38</product_a>
<product_b>12</product_b>
<product_c>301</product_c>
</region>
<region name="America">
<product_a>31</product_a>
<product_b>9</product_b>
<product_c>357</product_c>
</region>
</date>
<date name="04/01/2003">
<region name="Asia">
<product_a>33</product_a>
<product_b>12</product_b>
<product_c>301</product_c>
</region>
<region name="America">
<product_a>43</product_a>
<product_b>16</product_b>
<product_c>430</product_c>
</region>
</date>
<date name="05/01/2003">
<region name="Asia">
<product_a>36</product_a>
<product_b>12</product_b>
<product_c>301</product_c>
</region>
<region name="America">
<product_a>54</product_a>
<product_b>1</product_b>
<product_c>561</product_c>
</region>
</date>
</revenue>