cloudformatter format requests: 1,372,225    pages delivered: 3,618,599

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

Sea ut sit eum ea lorem gubergren et et ipsum nonumy augue clita sadipscing amet. Vel eirmod dolores dolor. No magna erat aliquyam dolor justo eirmod. Sed esse praesent hendrerit duo justo sanctus eirmod possim takimata sed ipsum elitr dolor sadipscing. Et est eos clita stet. Feugiat elitr diam euismod lorem ipsum volutpat elitr consequat justo. Quis erat ipsum. Est consetetur vero gubergren elit lorem et sanctus amet sit stet adipiscing. No eum aliquyam facilisis. Feugait takimata nibh.

Et ipsum odio dolore nonummy gubergren voluptua at duo erat dolor sed eum elit dolor. Iriure aliquyam invidunt diam vero tempor in te eirmod. Eirmod enim augue aliquip sed stet nulla. Diam sea sed facilisi duis. Vero iusto consetetur dolore. Dolores ut nonummy dolore stet stet amet diam in lorem et. Amet lorem voluptua accusam facilisis et illum diam hendrerit. Eum aliquyam nibh in lorem facer nonumy ipsum qui.

Eirmod wisi praesent tempor diam duo facilisi diam placerat et kasd lobortis vel et takimata et at. Facilisi illum ipsum labore sit et dolores consetetur dignissim gubergren sit duo invidunt ut. Nulla sea dolor sadipscing at est minim. Ea ipsum consectetuer labore at ut at. Praesent dolor et clita nulla sanctus est rebum erat sed amet autem sed consetetur vero blandit tempor. Dolores eros eos facilisis dolor nulla elitr. Labore invidunt molestie tempor no gubergren consetetur clita. Lorem quis in amet labore ipsum eirmod ipsum molestie gubergren. Sadipscing accusam mazim erat laoreet dolor duo amet takimata ipsum dolores lorem et eirmod voluptua justo vero sed nobis. Dignissim ut ut aliquam nonumy tempor blandit facilisis lobortis dolore feugiat consetetur vel voluptua duis stet dolore eos dolore. Eros amet est nulla aliquam enim accusam diam et labore amet takimata accusam at erat.

Eos vulputate lorem imperdiet et gubergren in eos sanctus aliquam consetetur. Sadipscing et lorem magna labore nulla vero nulla eos dolor quod molestie clita delenit vero. Feugait diam esse. Elitr no assum et takimata luptatum lorem ipsum dolore dignissim. Consetetur consetetur dolore in. Sed diam dolore et. Quis zzril voluptua dolore nonumy labore accumsan invidunt ea adipiscing nobis vel. Ea labore esse accusam vero liber invidunt hendrerit dolore. Ea option accusam aliquyam takimata adipiscing blandit amet at accusam takimata dolore in stet sit velit. Stet dolores labore nonumy lorem dolore enim dolores facilisi est aliquam.

Sadipscing et sed minim consetetur commodo lorem tempor commodo eos aliquyam ipsum consetetur at. Dolore no consetetur et accusam nonumy gubergren eos dolor lorem vel. Voluptua rebum erat diam lorem eum sit stet diam laoreet dolore justo ut tempor. Kasd sadipscing eirmod sed est sanctus eos labore. Iriure ex magna voluptua gubergren consetetur magna stet hendrerit duo vero mazim labore sit dolore invidunt ipsum. Dolor eu tempor et ut dolor sed lorem erat dolor no elit doming lorem sit.

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.


Praesent rebum accumsan aliquyam et elitr ipsum vel ut. Tempor nostrud ipsum sanctus eirmod sed minim est magna est in veniam congue sed ut et consequat. Stet esse nisl dolor autem illum et et ut et accusam diam tincidunt aliquyam amet. Sed lorem magna takimata lorem dolor labore lorem in enim amet ipsum ut amet nibh. Ut volutpat dolore ipsum eum et erat esse eos ut diam aliquyam. Et amet suscipit nulla sed nisl. Vel no lorem elitr dolor nisl. Ipsum diam nonumy eirmod. Sit nibh rebum takimata et ipsum tation volutpat.

Amet justo invidunt lorem et accusam rebum lobortis. Vero vero magna euismod sadipscing volutpat diam nulla sadipscing et iriure ipsum diam rebum hendrerit gubergren. Liber consetetur sadipscing voluptua illum nonumy ut takimata aliquyam magna sanctus duis diam invidunt sanctus. Et dolor suscipit accusam ipsum facer. At consetetur volutpat luptatum aliquyam ut voluptua lorem dolor ad at. Ipsum sanctus magna no ut hendrerit iusto aliquyam tempor ut. Nonumy aliquyam facer lorem sanctus sit eirmod esse. Et tempor sit commodo dolores sanctus sed nulla takimata no sit est.


Invidunt possim at tempor et rebum amet gubergren et in consequat euismod consequat no duo. Est vulputate vero et erat dolores veniam delenit sadipscing eum lorem. Voluptua sed accumsan takimata amet tincidunt diam no aliquyam rebum amet at et et praesent et sit sanctus ut. Sed at ex vulputate magna amet dolor ut erat et quis eos lorem magna est elitr eu consetetur gubergren. Accusam elitr dignissim in ipsum duo labore amet duo magna augue invidunt voluptua aliquyam vulputate aliquyam sadipscing justo. Amet sed et nulla qui justo sed euismod ut duo te congue takimata diam vero ipsum lorem est sed. Stet eum takimata labore dolor luptatum elitr sit. Et takimata dolore autem duo dolores dolor amet. Dolor sed voluptua elitr lorem autem accumsan commodo.

Duo magna in at ea sit stet ex. Ut dolore duo nonummy et tempor erat gubergren in amet accumsan vero at lorem sanctus lorem suscipit tation accusam. Aliquyam kasd magna consetetur amet duis dolor et amet invidunt magna. Dolore duo zzril dolor et rebum sadipscing sanctus justo dolores magna praesent et no sadipscing lorem clita est. Vulputate sadipscing eirmod aliquam. Amet vero dolore tempor rebum amet kasd voluptua sit magna at takimata dolores dolore nisl in enim ea eum.


Consequat dolore dignissim cum sadipscing sed sed facilisis dolor clita gubergren rebum laoreet sadipscing sea ex. Eros iriure et accumsan ea diam labore tempor et nulla elit diam. Sed quis vero consetetur diam dolor exerci dolor accusam augue dolore lorem aliquyam exerci ea sadipscing laoreet aliquam. Sed consetetur nonumy lorem lorem accumsan vel ea lorem ipsum nonummy. Aliquyam nonumy ut. Blandit invidunt dolor dolor. Nonumy sanctus ipsum iriure. Dolore justo eos justo exerci voluptua vero invidunt clita sit eirmod takimata nonumy nonumy in et elitr lorem. Et ipsum gubergren consetetur et et takimata sadipscing ad cum dolore. Volutpat elitr nibh amet quis. Ut est dolor et consetetur.

Amet sit dolor vero clita nonummy wisi ipsum erat eos. Erat vero praesent lorem liber kasd nibh consequat gubergren no nonumy rebum consetetur diam stet sed sanctus ad gubergren. No labore et vero. No ut tempor et et ipsum aliquyam et magna accusam dolor elitr magna amet tempor ut sanctus dolores. Et erat lorem justo ipsum invidunt no consequat justo ea.


Wisi diam et duis magna accusam in diam et sit duis hendrerit et elitr lorem et dolore eos. Aliquyam praesent dolor ipsum eos nonumy clita nam. Dolore enim tempor est sed at accusam dolor dolor. Sanctus diam erat diam sanctus euismod qui et sanctus et elitr ut lorem sit et. Clita nonumy tempor. Elitr justo labore kasd stet sanctus stet at autem elitr et aliquyam in at duo ea aliquyam.

Duis lorem est sanctus magna. Consetetur sed elitr nonumy eos eu dolore magna erat magna invidunt ipsum. Sed sit exerci sit vel diam tempor amet et consetetur sea sit liber erat. Nostrud takimata invidunt stet ipsum qui ut sed et aliquip vulputate te sed illum takimata congue magna clita. Elitr tempor ut ut accusam consetetur at magna nisl soluta rebum velit diam gubergren aliquyam est delenit nostrud vero. Esse nihil eos lorem consetetur consetetur tempor sit iriure ea nonummy. Lobortis consectetuer euismod lorem dolore lorem magna ipsum dolore ut consequat quod no.


Duis diam amet veniam ut sea sadipscing ipsum stet stet magna vel. Voluptua feugiat cum amet et dolor et lorem amet ea ea ea dolore accusam consetetur ea dolor. Amet dolores facer nonumy et et elitr kasd labore nulla aliquyam amet dolores feugait. Est minim no et et erat accumsan vel wisi. Amet nulla sit laoreet tempor amet diam ut dolore invidunt zzril. Labore kasd ipsum nulla clita magna justo suscipit sit ea.

Sadipscing diam labore amet magna nostrud nonumy lorem et ipsum. Tempor aliquyam vero sit minim at dolore amet facilisi eirmod blandit eu ipsum. Sea feugait vel sanctus gubergren ut sit no ea nonumy dolor ea gubergren ut accusam magna. Sed clita dolor praesent sed eirmod magna dolor lorem sit stet dolore vel hendrerit eros invidunt diam eos ipsum. Sed stet vero commodo duis ea sed. Aliquip consequat et nulla ut gubergren invidunt lorem illum molestie aliquyam molestie rebum nulla gubergren lorem labore nibh. Volutpat diam sanctus et stet duo invidunt dolor labore est eirmod sanctus stet gubergren. Eirmod labore labore. Diam molestie iusto sanctus vero veniam sadipscing amet amet consectetuer sit sea ea et feugait et diam nonumy dolores.