Multiple Table Captions

Forwarding here for future reference. The original use case is,

Michael Day wrote:

>  - Allowing table captions to be repeated on each page that a
>    table appears on, not just the first page. (Perhaps a
>    caption-repeat property?)
> 
>  - Allowing table captions to be changed on subsequent pages.
>    The classic example is:
> 
>     first page:  Table 1
>     next page:   Table 1 (cont.) 

-------- Original Message --------
Date: Tue, 02 Oct 2007 23:44:06 -0400
From: fantasai
To: Michael Day
CC: Grant, Melinda, Håkon Wium Lie

Michael Day wrote:
 > Hi Melinda,
 >
 >> Sequential(?) captions sounds good.  It would be nice to avoid markup
 >> implications. ;-)
 >
 > Currently, the CSS table model allows multiple captions, top and bottom,
 > but HTML only allows a single caption per table. Opera and Prince support
 > multiple captions, while Firefox only uses the first.
 >
 > I think there are good reasons for allowing multiple captions, and it
 > might be worth passing this on to the HTML5 group.
 >
 >>     table#target-table caption { sequence(content: "Caption", "Caption (cont.)") }
 >
 > Our customers want to keep the caption content in the document rather
 > than in the CSS, although arguably the (cont.) is presentational.
 >
 > Another possibility is to have one caption element in the document and
 > generate the other:
 >
 > caption::after {
 >     display: table-caption;
 >     content: contents() " (cont.)";
 >     caption-repeat: following
 > }
 >
 > However this won't quite work, as ::after will the second caption inside
 > the first, not actually after it. You would need the proposed ::outside
 > pseudo-element or something else. Or just use table::before, but then
 > you can't capture the content of the first caption. Perhaps there is some
 > other way to make it work.

How about having one caption in the markup, having a property to control
whether it repeats, and then a pseudo-class for repeated elements?

e.g.

   <table>
     <caption>Something or Other</caption>
     ...
   </table>

... some magic CSS to make caption repeat ...

caption:repeat(1+n)::after { content: " (cont.)"; }

(Can we move this discussion to www-style, btw? It wouldn't hurt to get
others' ideas.)

~fantasai

-------- Original Message --------
Date: Thu, 09 Oct 2008 09:33:49 +1100
From: Michael Day
To: fantasai

Hi fantasai,

 > Can I post this to www-style?

Sure.

At the moment in Prince we have implemented this property:

     prince-caption-page: first | following | all

And we use it in combination with multiple table captions.

Best regards,

Michael

-- 
Print XML with Prince!
http://www.princexml.com

Received on Thursday, 30 October 2008 00:19:39 UTC