cloudformatter format requests: 3,265,706    pages delivered: 8,453,689

Pass-Through XSL FO Styling

xportability LLC

Pass-Through XSL FO Styling



We implemented the spacialized attribute fostyle to carry this information. Because the browser just ignores this, you must be careful to structure it correctly for processing. The proper structure is name: value; noting that the ":" after name is followed by a space and the ";" between items is also followed by a space.

In some instances you may wish to pass through XSL FO attributes that are not supported in HTML. This is an example, while the text in the HTML has a brown color applied, we have applied a CMYK color for the PDF generation through the use of the fostyle attribute. All fostyle attributes are applied after HTML css and also after direct attributes and override those in the HTML. This paragraph also has text-align justify in the HTML and font-stretch, font-size-adjust and hyphenate in the PDF output. The fostyle attribute is attached right in the HTML, just like style and uses the same structure internally as style.

The code for the paragraph above looks like this:

<p style="color: brown; text-align:justify;"
    fostyle="text-align-last: left; 
    font-stretch: wider; 
    font-size-adjust: 0.6; 
    hyphenate: true; 
    color: rgb-icc (255, 255, 0, #CMYK, .1, .2, .7, .5);">In some instances ...

Keeps of Various Kinds

Another common use for passing through custom elements is for properties that have specific meaning in a pagination situation like "keeps". There are several forms of keeps that can help you organize content so it is glued together as you like it.

The following are the most commonly used keeps:

  • keep-together.within-page: set to "always" and used to keep a block of content always together in a single page
  • keep-with-next.within-page: set to "always" and used to keep a block of content glued to the next one always together in a single page
  • keep-with-previous.within-page: set to "always" and used to keep a block of content glued to the previous one always together in a single page
  • keep-together.within-line: set to "always" and used to keep a span of content glued always together in a single line

The following shows some demonstrations of these capabilities.

Keeping Together Within a Page

This paragraph, the instructions and the following three para's of LoremIpsum text are surrounded by a <div> with keep-together.within-page as always, like this:

<div fostyle="keep-together.within-page: always;">
    <p>This paragraph, the instructions and the following five para's of LoremIpsum text are surrounded 
    by a <div> with "keep-together.within-page" as "always", like this:</p>...

Amet et dolor at voluptua et sit ipsum amet erat lorem ea dolor vulputate. Aliquyam kasd ut sanctus elitr gubergren eirmod eirmod et dolor aliquyam. Velit ut amet placerat et at takimata duis dolores accusam nostrud duis magna esse et ullamcorper. Sed id autem molestie sit kasd augue amet diam. Sed nam et ipsum sed clita et invidunt commodo ex ullamcorper et sadipscing amet takimata eu labore dolor consequat. In odio rebum accusam lorem ipsum qui in. Vero eirmod no et lorem ea sed labore sit illum in feugait magna odio. Erat takimata consequat labore vero consectetuer dolore gubergren clita ut nam nisl sadipscing nibh ipsum at facilisis. Sit diam clita commodo et augue eu veniam doming et hendrerit kasd labore duo sit est sadipscing zzril eirmod. Sit velit elit sea aliquyam lorem hendrerit et justo nonumy dolor.

Sed accumsan diam feugiat autem sed tempor lorem stet diam dolor accusam enim consectetuer esse ut eirmod et dolor. Et sed et. Dolor ipsum dolore. Amet gubergren sanctus eu et. Iusto stet vero ut euismod et sit zzril eirmod ea invidunt accusam zzril ipsum nonumy. Lorem dolor sit clita nonumy commodo. Aliquyam augue aliquyam lorem labore velit ipsum duo clita eos consetetur stet sed euismod. Ut at invidunt elitr laoreet voluptua clita magna lorem exerci elit sanctus dolore nisl eu sit et. Aliquyam at euismod. At amet gubergren invidunt nonummy vero ipsum hendrerit nonumy clita et ea kasd vero.

Voluptua ullamcorper justo et sadipscing diam. Et vulputate eirmod ipsum diam sed elitr aliquyam sit et. Assum ut ipsum possim aliquyam eirmod dolores ipsum erat invidunt nonumy clita sadipscing. Vel invidunt amet placerat quis et hendrerit et labore voluptua ad dolore vel nisl. Ipsum consequat et ipsum dolores blandit nihil enim est diam aliquyam dolores. Diam delenit sit feugiat diam nonumy at. Dolor magna nulla diam eirmod lorem magna sanctus. Eu vero te ex volutpat et sanctus dolor nibh in labore blandit nulla ea facilisis no te sed ut.

Elitr sanctus sadipscing dolor amet diam eum nulla sed consequat sed sit aliquyam iriure lorem accusam voluptua dignissim diam. Dolore vel et consetetur. Nam exerci erat gubergren. At amet et diam sea accusam dolores et labore sadipscing diam velit vel sea takimata sed. Assum facilisis vero blandit no elitr sed ipsum no nonumy lorem amet aliquyam in ad ipsum. Sea diam odio nonumy stet dolor ut sadipscing.

Sadipscing quis ut ut tempor dolor sed et dolore invidunt at et feugait duis. Lorem amet blandit et lorem esse duo sanctus stet amet veniam volutpat eos dolor at et gubergren sanctus nonumy. Kasd at luptatum clita sed vel volutpat elitr clita. At ut accusam dolor accusam ut et eirmod magna nihil at dignissim accusam vero elitr ea tempor sit. Molestie ipsum gubergren justo. In et illum vulputate vero et nonumy voluptua consetetur sea at clita delenit hendrerit aliquyam stet duis.

Thus all of this content from the header through this paragraph is together on a single page.

Keep Heading with Para and Table

A common practice in print documents is keeping together headings and some of the following lines of a paragraph so no heading is orphaned at bottom of a page and at least a few lines of text from any paragraph stay together.

What follows this are a series of headings and LoremIpsum paragraphs. The headings all have "keep-with-next.within-page" as "always" which will at least glue them to the paragraph. The paragraphs all have widows of "3" and orphans of "3" which will attempt to glue together at least three lines of paragraph at the bottom and top of any page. The LoremIpsum paragraphs are randomly generated on refresh of the page so you can test various layouts just by refresing and printing again.


Sed nulla facilisi tempor nibh lorem stet ea aliquyam amet duis. Ea eu et feugait zzril. Rebum vel clita elitr. At rebum lorem sit sit. At aliquyam ut magna lorem at te dolor eirmod sea dolor eos lorem no voluptua dolores et kasd. Consetetur eum rebum magna velit nostrud facilisis dolores et magna. Nibh hendrerit sanctus amet tation lorem tation lorem amet est consetetur takimata nonummy eos amet clita. Et et nonummy elitr nonumy. Sed ipsum nibh dolore duo vulputate tincidunt tation sit accusam. Eleifend consetetur accusam lorem sit. Lorem lorem amet quod adipiscing.

Sed sed ex et ut dolor justo dolore molestie diam et feugiat magna aliquip tempor. Aliquyam stet diam volutpat nonummy elitr duo elitr lorem dolore et tempor exerci lobortis eos. Stet est elitr consetetur invidunt ea eros lorem dolore illum. Duo ipsum eos. Tempor dolor clita.


At diam te lorem eos sea duo ipsum invidunt esse tempor erat lorem commodo invidunt te. Amet sit erat molestie diam lorem sit et amet sadipscing aliquyam clita. No eleifend augue elitr ut voluptua nibh sadipscing. Vel duis ut delenit ea aliquyam dolore rebum aliquam dignissim amet no dolor amet vero feugiat. Consequat enim ipsum eos dolore eirmod.

Diam est sit clita ipsum kasd ea justo erat esse eirmod dolore. Exerci et ipsum consequat hendrerit gubergren. Accusam clita dignissim at et accusam. Et diam ipsum ea kasd consequat elitr aliquyam voluptua luptatum. Est sed aliquyam sea duo elitr justo magna et vero ea tincidunt et nulla sed justo qui ea ea. Clita voluptua duis lorem sit magna. Sed autem nam justo diam eu illum accusam ea possim illum exerci ad takimata ipsum in. Consectetuer adipiscing dolore takimata dolore gubergren lobortis vero in. Diam feugiat facilisis magna. Molestie et sed vel sit sanctus exerci elitr consequat tempor stet illum eirmod labore est. Dolor takimata dolor lorem eu et lorem.


Ipsum erat labore facilisi diam elitr accusam no justo. Vel lorem dolor sadipscing sit diam sea gubergren ut justo gubergren magna dolor ut accusam delenit et vel et. Volutpat dolor stet sea consequat voluptua. Ut no nonumy elitr feugait justo ipsum et et est magna duo accusam erat kasd. Voluptua rebum sit vero ipsum dolore rebum et. No justo euismod est consequat amet augue. Sit nulla sit kasd sed. Eleifend eirmod magna duo suscipit. Lorem sea dolor ullamcorper kasd. Nibh dolor et clita.

Exerci et duis qui iusto euismod labore gubergren consectetuer ea accusam rebum gubergren dolor lorem dolor amet. Nulla tempor invidunt erat. Enim nonumy justo dolor amet sit minim aliquip diam voluptua. Dolor sea ut magna et. Et option diam blandit sed et consequat tincidunt eirmod dolores diam sadipscing accusam vel lorem diam elit. Magna dolor eum. No vero gubergren aliquyam tempor lorem ea sed sed rebum vero gubergren et et nonumy.


Sanctus facer dolor clita dolores voluptua sit vulputate amet dolor sadipscing duis. Qui sit invidunt dolore velit et sea diam amet sadipscing sed vel nonumy voluptua aliquam kasd. Aliquyam ipsum magna facer sed ipsum nibh voluptua elitr sit vel tation. Ipsum takimata augue at rebum dolor. Diam et eos ipsum duo consetetur dolore eos ipsum nihil aliquyam voluptua nulla diam accusam molestie et diam sed. Lorem dolor consequat et vel molestie at takimata et justo stet stet et invidunt duo.

In diam magna amet et no. Accusam nisl labore sadipscing magna lorem sanctus erat labore lorem. Enim vulputate takimata eos amet ea sed sit sit labore dolores ipsum in nostrud. Accusam dolore at consequat ipsum. Consequat labore consetetur tempor. Dolore voluptua ut sit sit erat et ex et eirmod vero dolore diam nulla gubergren. Clita erat tempor. At et lorem. Et molestie est ut dolores diam iusto. Vel blandit lorem ea dolores. Labore et eu tempor sea dolor dolor facilisis.


In rebum magna ut in. Laoreet et dolor molestie erat. Takimata tempor invidunt elitr ad clita consectetuer accusam nonummy nibh odio rebum sit. Invidunt sed elitr clita labore amet amet possim et. Nonumy et et feugiat dolor eirmod nulla nulla sit aliquip magna. Vel ea at consequat erat ipsum sea sea clita. Diam sed ut feugiat nulla diam dolor ut dolore tempor est praesent sit. Nonumy et et hendrerit tempor diam gubergren laoreet dolore accumsan invidunt voluptua. Lorem dolores et magna nulla sed sed takimata consetetur sit consequat rebum rebum dolor aliquyam no augue. Et sit kasd eum no. Justo et et sed magna nonumy amet at amet elitr sit.

Eos magna dolore at nulla amet vero sed at vero aliquyam diam feugiat eirmod amet. Aliquyam no tempor sea lorem amet lorem dolor adipiscing lobortis elit sit sadipscing. Est sed delenit erat placerat in accusam accusam labore amet labore dolor iriure sit elitr amet lorem sed nonumy. Invidunt eu dolores et. Dolore kasd vero voluptua et et vero labore kasd justo sanctus dolore amet diam. Sit in at consequat ullamcorper volutpat eleifend sea iriure sit luptatum hendrerit ipsum elitr diam sea velit.