Forum Moderators: open
<item>
<description>Some item</description>
<price month="1">500</price>
<price month="2">300</price>
...
</item>
<item>
...
</item>
...
__________1___2___3___4___5___6___7
Some item 500 300 100 700 500 300 100
First problem: I plan on fetching the headers (months) from the first <item> - if this item lacks data for one month I won't get the header for that month and my table becomes incorrect - how do I handle that?
Second problem: If any given <item> lacks data for one or more months, how can I make sure an empty cell is displayed instead of moving the rest of the data on cell to the left?
Hope this was clear enough, and any help will be greatly appreciated!
There are so many ways that you can skin this cat. I would concur, post what you have, and we can take a look.
while we wait,
can you control the xml? add a <price month="9"></price> or <price month="9">0</price> for the null value entries? This would add some consistance in the xml that you are provided.
The other idea would be to assume that you want everymonth, all 12 of them displayed. Then you could *iterated* for 12 and display all the months. If, when tested, the month does not exist, then do the value does not exist algo.
But the code would really help...
Post the, if you have it, the xml, xsl, xsd(dtd), desired output example ext.