Forum How do I...?

dynamic content in table headers and footers

azehender
Dynamic content with name strings doesn't seem to work in table headers and footers.

I put two placeholders in an html document: a div, which contents is stored in a named string, and a span, which should be replaced by the last value of the named string of the current page.

div.macroinnersum { string-set: macroinnersum content(); }
span.macroinnersumresult:after { content: string(macroinnersum, last) " " counter(page) }


The replacement works well in page header and footer, as well in normal content, but not in table headers and footers. There the string is allways empty.

The full (php) code to reproduce:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>test</title>
	<style type="text/css">
	h1 {
		counter-increment: h1 1;
		counter-reset: h2 0;
	}
	h1:before {
		content: "Chapter " counter(h1, upper-latin) " - ";
	}

	@page {
		margin: 2cm;
		counter-increment: page;

		@bottom {
			content: string(macroinnersum, last)
		}
	}

	div.macroinnersum { string-set: macroinnersum content(); }
	span.macroinnersumresult:after { content: string(macroinnersum, last) " " counter(page) }

	span.marker_page:after { content: counter(page); }
	span.marker_pages:after { content: counter(pages); }

	</style>
</head>
<body>
<h1>Test</h1>
<h1>Test2</h1>

<table border="1">
	<thead>
		<tr>
			<th>header</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th>footer</th>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td>
				<div style="height: 10cm">1</div>

				<table border="1">
					<thead>
						<tr>
							<th>inner header <span class="macroinnersumresult"></span></th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<th>inner footer <span class="macroinnersumresult"></span></th>
						</tr>
					</tfoot>
					<tbody>
						<?
						for($i = 0; $i < 100; $i++){
							?>
							<tr>
								<td style="page-break-inside: avoid;"><div  class="macroinnersum"><span style="color: #ff6666"><?=$i?></span></div><div style="height: 1.5cm">inner <?=$i?></div></td>
							</tr>
							<?
						}
						?>
					</tbody>
				</table>
				<span class="macroinnersumresult"></span>

				<div style="height: 10cm">4</div>
				<div style="height: 10cm">5</div>
				<div style="height: 10cm">6</div>
				<div style="height: 10cm">7</div>
				<div style="height: 10cm">8</div>
				<div style="height: 10cm">9</div>
				<div style="height: 10cm">0</div>
			</td>
		</tr>
	</tbody>
</table>

</body>
</html>


Btw: Floats seem to have the same limitation.

Can you help?
mikeday
Thanks, we'll take a look at this issue.
azehender
Any news on that issue?
Can you suggest a workaround?
mikeday
Sorry not yet; we are looking at it and will try to fix it for the next maintenance release.
mikeday
Checking back on this issue, I think it works now? :)