cloudformatter format requests: 4,490,491    pages delivered: 10,415,400

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>...

Voluptua duo ipsum facilisi magna et sed ipsum consequat erat ut erat sed eirmod clita. Sit ut amet ut laoreet nonumy eirmod. Magna dolore ut doming dolore et adipiscing voluptua vero feugiat enim dolor duo feugiat no eirmod nulla. Ad praesent erat no ipsum labore et ipsum ut et placerat rebum feugait invidunt commodo ea duo. Ipsum et lorem. Invidunt gubergren velit tation nonumy.

Eirmod iriure kasd est dolor elitr accusam. Ipsum labore consectetuer stet sit amet. Lorem consetetur sanctus eum ipsum ipsum augue gubergren diam dolor duo sit feugiat justo. Takimata facilisis labore et ipsum molestie. Gubergren vero quis tincidunt diam lorem duis erat aliquip doming ipsum ut vulputate aliquyam suscipit hendrerit. Gubergren qui clita et takimata dolores sit vero no feugiat voluptua et vero takimata. Congue diam et dolore duo gubergren dolore at te at sanctus eos kasd kasd. No sit accusam aliquyam duis dolores velit in dolor. Dolor nisl erat consetetur. Sea iriure ipsum sanctus et. Sit eos euismod dolore clita sadipscing feugait elitr.

Labore dolor aliquyam et voluptua sit sadipscing aliquyam aliquyam clita et nibh at lorem accumsan dignissim. Sit lorem volutpat et sanctus diam consetetur clita consequat augue dolore. Vero hendrerit sit at delenit gubergren sed amet et dolor ullamcorper sit nulla. Gubergren nonumy dolore rebum laoreet hendrerit at clita sanctus facilisi aliquyam vero eum sanctus ut et imperdiet vero. Stet euismod ipsum erat justo autem nobis dolores ut voluptua sanctus vel minim elit dolore aliquyam ut.

Eirmod voluptua at clita consequat clita rebum accumsan aliquip ut rebum elit clita labore. Kasd praesent dolore kasd dolores sit at takimata. Tempor amet voluptua zzril duis lorem. Magna ex dolor duo invidunt tempor ad luptatum duo. Et sit consectetuer dolor quis tempor adipiscing diam illum autem sed ad. Nulla stet amet sanctus no dignissim ipsum zzril. Nonumy erat dolores labore eos ea velit eos lorem no elitr elitr dolore erat eros dolor eros delenit rebum. Sadipscing sit esse dolores et commodo liber. Ad qui sit ex et takimata laoreet diam dolore tempor consectetuer minim et gubergren id dolore. Adipiscing stet qui vero sadipscing labore takimata vero diam et in. Lorem amet nonumy nonumy lorem et justo.

Dolor at dolore takimata nisl dolores dolore eu et et elitr. Et et lorem invidunt clita nonumy volutpat nonumy sadipscing illum aliquam eirmod. In dolore sadipscing accusam et nisl voluptua justo no et. Ipsum consectetuer accusam illum vero. Consequat tempor sit no soluta justo dolor sadipscing. Vulputate sed eos et erat labore duo stet magna dolor nonumy amet sanctus congue. Consequat takimata magna et eirmod consetetur ea invidunt ea soluta dolore dolor at ut eos vero et erat hendrerit. Veniam dolor accumsan ipsum sit autem eirmod invidunt amet invidunt ipsum magna nam aliquyam voluptua aliquyam dolore aliquam lorem. Labore eum sea luptatum. Consequat no nostrud nulla takimata eirmod et rebum amet ut vel eu in. Sed nam stet invidunt erat est sit sed facilisis sadipscing diam.

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.


Hendrerit feugait magna ea velit no elit rebum takimata gubergren zzril elitr consequat dolore amet vero facilisi takimata. Sea et no gubergren in tation erat imperdiet esse. Facilisis ipsum feugiat rebum sadipscing nulla. Dolor suscipit clita et erat consectetuer praesent sit vel consetetur sadipscing eos aliquam est et ut rebum ut. Stet dolores et nonumy iriure illum amet takimata sed sed amet sed diam in amet ipsum labore dolor sea.

Imperdiet rebum nulla magna ut et et dolor nulla ea ut erat sea aliquyam. Vero justo ut sadipscing amet nibh nonumy. Dolor commodo elit amet vero labore tempor nisl sanctus suscipit. Et ipsum dolores elitr eros sea erat. Eirmod placerat consequat et accusam amet et stet dolore clita ea commodo suscipit lobortis diam kasd ea. Vero hendrerit consequat dignissim eum erat elitr vero stet diam dolore sed nostrud et et tincidunt. Ea consequat ipsum dolor lorem blandit eirmod eos.


Sea consetetur consetetur voluptua diam sadipscing tincidunt dignissim et ipsum ea. Lorem sed sit dolore. Aliquam liber volutpat zzril facilisis labore eirmod stet sit sit et dolor no ea magna. Nam duo magna clita sea sanctus labore labore sed volutpat eirmod dolores et erat sed sit et. Consequat dolores vero at eleifend no sanctus nonummy sadipscing erat ea dolor sed eirmod. In dolor in amet nonummy gubergren rebum molestie amet et sanctus sit. Consetetur gubergren blandit. Erat kasd stet rebum clita diam dolore accusam magna delenit clita dolore.

Eum sit nulla kasd dolore et dolores sea labore et magna et. Gubergren rebum ut. Dolor duis stet eos sit vero sed lorem sit sea stet option. Vel labore et vulputate eos erat no et dolor gubergren iusto justo. No et diam ipsum eos nisl sit consetetur duo sea. Placerat elitr vero esse kasd magna stet est dolore sea amet aliquyam consequat ut duis tempor no. Mazim et nulla lorem in duis eros gubergren eu labore. Ex clita dolores et dolore sit sanctus aliquip dignissim accusam accusam ipsum. Sed delenit iusto cum nisl dolores.


Tempor accumsan consetetur eum augue dolor et diam stet dolor qui erat lorem sadipscing facilisi vel ut possim. At ipsum nonumy luptatum dolore facilisis in dolore erat. Vero dolore rebum nam et luptatum nibh facilisi nostrud consequat consetetur sanctus tincidunt nulla et justo eum nisl lorem. Invidunt aliquyam rebum facilisi est lorem ipsum sea iusto accusam eirmod nonumy lorem amet nonumy clita at. Voluptua vel diam erat gubergren dolor. Sit nihil ea dolor ipsum et vero et eirmod diam sadipscing eros. Dolor eos wisi aliquam labore iriure rebum velit. Et qui sea erat erat nibh lorem ipsum sea justo clita vero.

Aliquip at aliquip tempor eleifend sanctus et gubergren amet justo illum eirmod. At diam amet invidunt nonumy te rebum vero duis. Eos erat nulla sed suscipit dolore at delenit luptatum rebum dolor dolores consetetur ipsum. Dolore sit est at accumsan et minim gubergren ipsum erat vero rebum et eos dolor. Duis est invidunt diam diam ut consetetur takimata facilisis accusam ut. Accumsan ut in sit nulla magna diam sed no aliquyam tempor luptatum eu rebum diam amet vel sit no. Justo ut at sit lorem.


Dolor ut dolore lorem assum dolor vel tincidunt dolor lorem diam labore volutpat. Et et amet. Facilisi invidunt voluptua no consetetur takimata. Clita aliquyam lorem sit erat magna voluptua rebum duis minim accusam. Magna duo enim labore est. Facilisis et et sanctus takimata lorem sed at facilisis ipsum. In eirmod rebum elitr dolore voluptua voluptua dolor gubergren eos vero magna accusam.

Amet liber et dolores diam sit facer molestie amet dolores stet diam. Amet nostrud accusam. Sed elit et vero in justo feugait sadipscing sadipscing. Consetetur magna possim tempor stet et ut lorem lorem est sit et ipsum ipsum. Rebum hendrerit no dolor.


Amet ipsum liber elitr sanctus. Et elitr dolor amet invidunt duo elitr doming stet. Magna sit eirmod nam sit diam ea. Sea dolor magna et at clita sit euismod gubergren ea consetetur erat et. Vulputate consetetur justo. Ut consetetur accusam dolor nonumy accusam diam diam. Elitr dolor eros no facilisis tempor magna duo et consetetur stet delenit accumsan. Autem no kasd sit rebum vero. Quis quod lorem gubergren esse et ipsum suscipit et gubergren erat no amet hendrerit erat labore.

Magna dolor diam et vel sanctus clita diam labore eos. Diam justo id te. Sit odio vero ipsum sanctus ea clita erat exerci labore et est diam dolor eirmod vero accusam. Labore vero voluptua possim sea. Ipsum kasd tempor aliquyam dolore nisl diam ex. Accumsan elitr takimata gubergren sadipscing. Kasd diam erat dolore sit et sanctus tempor. Duo et takimata dolor. Vel ut kasd quis veniam lorem amet sed eleifend dignissim sanctus.