Forum Bugs

generated content in table footers/headers

paj262
I am trying to create an invoice using a dynamic table where the footers contain the total or subtotal for a table that is split across multiple pages.

I am using the following HTML code:
<table>
  <thead>
    <tr><td>Part No.</td><td>Price</td><td class="subtotal"></td></tr>
  </thead>
  <tbody>
    <tr><td>10001</td><td>$3750</td><td class="subtotal">3750</td></tr>
           :
    <tr><td>10005</td><td>$1250</td><td class="subtotal">205000</td></tr>
  </tbody>
  <tfoot>
     <tr><td id="footer"></td><td id="total"></td><td class="subtotal"><td></tr>
  </tfoot>
</table>

linked to a CSS with:
td.subtotal {
  display: none;
  string-set: total content();
}
#footer {
  content: string(footer,last);
}
#total {
  content: string(total,last);
}
tbody tr:last-child {
  string-set: footer "Total";
}
tbody tr {
  string-set: footer "Subtotal";
}


Unfortunately the footer always shows "Total" and "205000". Using the same strings in the page header reveals the correct values for each page. To get the correct values in the page header I need to set the display property to a value other than "none" for the td.subtotal elements.

Any ideas on why this does not work?
mikeday
I'm not sure if Prince can change the table header and footer content dynamically on different pages like this. It does sound useful, though!
paj262
Well there is nothing mentioned anywhere that it should not be able to :wink:.
Generated content seems to be working everywhere else and the values are correctly calculated and stored (just try putting them in the page header or footer).

There are many cases where the header/footer of a table broken across pages would need different headers & footers. I think it make sense to have it implemented.
mikeday
Right, I'll add it to the roadmap for inclusion in a future release.
rpilkey
I am also interested in this problem of dynamically setting the thead and tfoot on each page. Here is a simpler example, hope that helps.
<html>
<head>
<style type="text/css">

body {string-set: thead_tfoot "start value";}

tbody tr:first-child { string-set: thead_tfoot "Continued..."; }

tbody tr:last-child { string-set: thead_tfoot "last table page"; }

thead th { content: string(thead_tfoot); }
tfoot th { content: string(thead_tfoot); }

</style>
</head>

<body>
    <table border="1">
        <thead>
            <tr> <th>Header</th> </tr>
        </thead>
        <tfoot>
            <tr> <th>Footer</th> </tr>
        </tfoot>

        <tbody>
            <tr><td>test</td></tr>
            <tr><td>test</td></tr>
...repeat until page breaks...
            <tr><td>test</td></tr>
            <tr><td>test</td></tr>
       </tbody>
   </table>
</body>
</html>

art
I second rpilkey, we could use that feature exactly as described.