Under Community Review

CSS Paged Media: return to PS sequence previously in use

A bit difficult to explain this one, so stay with me...

In CSS and using the Paged Media way of setting up PS/PL spec, the way to call in PS sequence is by using the 'page' property.
So something like:
    page: standard;
will call in the PS sequence called 'standard'.

Now the default value for the page property is 'auto'.
And 'auto' means (according to the 9.4 doc):

This is a CSS keyword. Although the page property does not
inherit its values from its parent element by default, the auto
value ensures that the value specified on its nearest ancestor
(with a non-auto value) is used.

So imagine that you are in a page sequence called 'standard' and you encounter an element 'landscapeTable'.
In the 'landscapeTable' element you ask for 'page: landscape;'.
This calls in the landscape PS sequence.

So far so good. No problems with that.

But what happens when the 'landscapeTable' element ends.
Well according to the current doc, you would automatically return to the PS sequence call 'standard'.

Unfortunately this does not happen.

So hence this request to enhance XPP so that this becomes possible.

The way I see this working is as follows:
- when the 'landscapeTable' element finishes, XPP returns to the PS sequence that was previously in action, continuing the sequence as is was left off = not a restart of the PS sequence (hence no first page,...) but just a continuation of standard pages.

- in order to make this work we need to be able to force a continuation on a left or right hand page, hence we need something like:
   display: -xpp-page-right;
to be set on the element that follows the 'landscapeTable' element.

Like this we would force the landscape PS sequence to insert a blank landscape page if necessary before returning to the previous PS sequence.

What would be the advantages?
The main advantage is that you do not have to remember the previous PS sequence that was active when you encounter the 'landscapeTable' element.
You just switch to a different PS sequence for as long as the 'landscapeTable' goes on and when the element is done you return to the previous PS sequence.
Another advantage is that we can forget about creating a 'continued' page sequence for each 'standard' page sequence that can get interrupted by something like a serious of landscape or foldout pages
Last advantage is that would make things a lot simpler and more understandable for people who are new to the system.

And that last point is what it is all about in the effort of implementing CSS in XPP: make things more simple 

  • Steve,

    The new feature to call out a named ps spec is indeed useful, but not exactly a solution for this problem.

    I was already afraid that it would be difficult to implement the expected CSS behaviour in XPP.
    But I have been thinking about this and maybe there is solution.

    What is we get a solution based on the xpp attributes feature that has been added to solve our tabular problem.
    Maybe there could be an xpp attribute added that keeps track of the PS name or number.
    Plus an easy way to store a named PS sequence into the 'ps' xpp attribute and an easy way to restore the value stored in the the 'ps' xpp attribute.
    We would still have do something extra (= restoring the ps sequence from the attrribute) in the '::after' pseudo-element (in my example that would be in the 'landscapeTable::after' rule). I think that this solution would be elegant enough.
    The only thing I would worry about if this gets implemented would be the possibility for the </landscapeTable> element to shift to the start of the next page. 
    As you are aware, that would be a no-go in a looseleaf environment.

    Hey and if we could put the ps-restore and the new page into the landscapeTable::after rule and the </landscapeTable> element would still not shift to the next page, that would really and truly be awesome! (to me it is not completely clear what makes an end element shift to the next page, you know that better than I do :-)

    Getting a ps-store and ps-restore command  (or property of perl function or whatever thing that is not overly complicated) would even be a better solution than something automatic. As it leaves  the flexibility of what needs to happen into the hands of the (capable?) user. 

    It would be even nicer if we can ask for a 'continuation' of a ps-sequence that got interrupted (instead of a restart) which would give the flexibility to decide if you want to force a filler page or not + eliminate the need for the creation of continued ps-sequences.

  • This is not really possible due to the design behavior of the "ps" (page sequence) rule change. There are a lot of side effects from changing styles and it is not possible to overlay a CSS "restore" type behavior on top of it.

    We have implemented a second argument to the  "ps" macro that will allow you to reference the CSS page "name" in a "::before" or "::after" pseudo-element. This gives you the ability to change the page sequence by name instead of number in case the "css2pagespecs" process assigns a new number to that particular page name. Is this sufficient?

  • Not encountered interrupting landscape pages in CSS yet but from your description you suggestion seems very sensible.