CSS3 Paged Media - Grammar incorrect

Hi all

The grammar for the @page rule in CSS3 (at http://www.w3.org/TR/2004/ 
CR-css3-page-20040225/#syntax-page-selector) is slightly incorrect.  
The @page block is defined to be:

  PAGE_SYM S* IDENT? pseudo_page? S*
    '{' S* [ declaration | margin ] [ ';' S* [ declaration |  
margin ]? ]* '}' S*

and "margin" is

   margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S*

However this won't match constructs like

   @page {
     @top-left { this:that }   <---
     size: A4
   }

because a semi-colon would be required after the inner "}", where  
I've arrowed.

If I were to suggest a fix, I'd suggest ensuring the margin blocks  
came before any declarations, which would allow the rule to be  
rewritten as

  PAGE_SYM S* IDENT? pseudo_page? S*
    '{' S* margin* declaration? [ ';' S* declaration ]* '}' S*



On a related note, in CSS2.1 the grammar doesn't allow for a @page  
rule inside a @media rule, ie.

   @media print {
     @page { size:A4 }
   }

is disallowed. Is this deliberate?


Cheers... Mike

Received on Tuesday, 28 March 2006 11:00:55 UTC