Your template HTML has id attributes in the <tr> elements which you use to find the appropriate node in the template.
When you unroll the tree, do you remove this attribute? This would be necessary to get valid XHTML, as no two nodes in an XHTML document can have the same id.
This leads to a more general question of attribute rewriting with this tree-based approach. I'm thinking specifically in terms of using a class attribute instead of putting in HTML-presentation based attributes like BGCOLOR.
I assume it is done in a similar way to the content, in that you just repeat the row with another 'iteraten' id for each new attribute (easier for page designers, perhaps). The alternative is to have a single sample line, and programmatically replace the class value, as per the element content for each node. This approach has the obvious disadvantage that a designer would only see a table with one row.
One final thing to consider with the DWIM unrolling function: we often like to fill-out a table with a single row saying "No records returned" or similar when there are no records. This might be a useful extra argument to the DWIM function.
enough rambling... interesting article
In reply to Re: HTATR II: HTML table generation via DWIM tree rewriting
by Anonymous Monk
in thread HTATR II: HTML table generation via DWIM tree rewriting
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |