Forum How do I...?

Can you use the attribute from an html tag for the running header in the page margins?

dlpBNA
The code below works as far as setting the running headers to Close but has one minor problem.
If the div tag is the last element processed for a page the running gets set but the h1 tag starts the next page and the running headers are wrong on both pages. I could reverse the div and h1 tags but that would also reverse the problem. So it seems like the best way to make this work would be to use an attribute on the h1 tag instead of creating this fake div. I have been able to set the attribute to the content of the div but I cannot figure out how to get it to the running headers. I have tried, var(), attr(), string-set. I want the running headers to say Perfect. And like the string-set it needs to be the last instance on each page.

Can this be done and if so how?
Let me know if you need more info?

<html>
	<style>

	@page {
		margin-top: 51pt;
	
		@top-left {
			font-weight: bold;
			content: string(bnaid, last);
		}
		@top-right {
			font-weight: bold;
			content: string(bnaid, last);
		}
	}
	
	div {
		font-size: 0pt;
		string-set: bnaid content();
	}

	</style>
	
	<div>Close</div>
	<h1 data-bnaid="Perfect">Testing</h1>
</html>
  1. rhtestFile.pdf17.0 kB
howcome
Like this?:
<html>
<style>
@page {
  @top-left { content: string(bnaid, last) }
}
h1 { string-set: bnaid attr(data-bnaid); }
</style>
<h1 data-bnaid="Perfect">Testing</h1>
</html>

  1. foo.pdf26.0 kB
dlpBNA
Thank You - This seems to be working.