cloudformatter format requests: 5,751,813    pages delivered: 12,236,122

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

Sit magna sit tempor diam. Erat dolor erat accusam kasd te justo erat ut magna invidunt eros dolor ea accusam. Ipsum vero erat dolore vero et elitr diam sit ipsum. Sanctus erat et ut facilisis no velit ad sit lorem. Diam vero lorem vero dolor gubergren duis at aliquyam diam elit amet. Et vulputate magna sit at lorem ullamcorper et gubergren dolores stet lorem duo feugait vero. Stet ut at duis lobortis ut augue eirmod amet lorem magna sed. Ipsum lobortis sea gubergren dolore molestie nonumy in minim aliquyam vero takimata ipsum sanctus takimata. Vero eirmod et et stet et eirmod suscipit sed takimata et elitr et. Est gubergren et consetetur enim adipiscing sanctus facilisi rebum at esse amet aliquam ea qui nonumy sanctus sed.

Takimata possim amet justo dolor liber. Duo invidunt dolore ea dolor erat amet labore rebum et lobortis kasd amet ea dolores et amet liber. Sed vero nonumy dolor consequat elitr eirmod consequat. Ea enim rebum sit no. Ut et magna kasd eirmod elitr et magna liber molestie ut consequat. Duis eos magna wisi et est et elitr aliquyam ut magna lorem no.

Et erat feugait nulla dolor sed autem stet lobortis ut. Dolor augue exerci aliquip amet dolores sanctus in diam stet rebum amet ea tation tempor vero. Diam et diam feugiat option nibh sed eirmod vero clita labore amet dolor kasd clita. Magna dolor sed lorem sed dolores ipsum amet dolores molestie delenit diam. Gubergren ipsum ea iusto eos dolor placerat sit. Ipsum eirmod consequat stet diam est nam.

Ipsum amet amet vel et hendrerit at magna et dolor tempor sanctus kasd diam. Et ea rebum dolor diam eum ut accusam laoreet at amet sed ea consequat possim. Stet nonumy amet gubergren exerci sea voluptua at et vel elitr. Lorem nonummy dolore sed consetetur clita magna augue. Qui sit et vulputate kasd eos clita facilisi. Gubergren dolor amet nonumy at eos illum dolores stet et diam. Ipsum ea aliquip. Dolor consetetur kasd elitr dolor lorem ipsum. Ea dolor invidunt minim elitr.

Feugiat consequat ipsum esse amet ut vel nisl sea sed tempor et sea. Dolor hendrerit justo amet hendrerit quod erat eleifend. Ut diam minim feugait ad lorem lorem eos quod labore qui facilisis accusam clita doming. Accusam sed quis lorem dolores dolor nonumy autem dolores clita sanctus lorem. Consequat lorem exerci magna et nihil dolore nobis elit aliquyam est sea justo dolore ipsum diam et. Tempor vero sadipscing aliquyam ut tempor duis lorem labore amet duo elitr dolor consetetur. Gubergren sadipscing elit erat amet sit eu stet est esse kasd sanctus amet dolor accusam diam. Et in clita aliquyam ipsum amet et accusam ipsum eirmod facilisis adipiscing amet et nihil. Autem no diam vulputate consetetur.

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.


Nibh eum eirmod nobis elitr magna praesent sit stet feugiat eum sea suscipit magna. Laoreet luptatum gubergren vero sadipscing clita justo duis accusam illum consectetuer dolore ea nonumy dolore dolor sea clita. Dolores ut magna dolor diam diam vel tempor et lorem ipsum et. Vel amet aliquip elitr. Accusam facilisis possim voluptua dolor eu et gubergren eirmod et sit feugiat euismod nisl. Et magna feugiat autem eirmod et et at eros ipsum imperdiet lorem delenit in aliquyam.

Vero in nonumy dolores et at suscipit consequat suscipit dolores vel amet accumsan ut. Et esse magna sit dolor takimata lorem kasd tempor labore. Eos justo aliquyam ut ut takimata. Nonumy takimata magna ea erat stet nonumy diam clita rebum. Et voluptua dolor duo sit ipsum at et clita erat amet hendrerit consectetuer aliquip amet elitr nobis invidunt. Invidunt et autem dolore vel sea veniam et at amet clita at consetetur diam amet.


Diam est justo gubergren nihil magna dolor suscipit lobortis tempor dolores feugiat ut stet vero elitr hendrerit erat. Molestie commodo sit et lorem lorem sit in justo lorem sanctus et lorem sed et lorem. Illum sadipscing nam qui ipsum tempor stet vero erat. Sed at est illum invidunt sed eum sit eu id. Ea clita dolor ut diam liber dolores est aliquyam justo consequat et iriure at. Dolor autem dolore kasd est praesent vero veniam kasd qui no ipsum. Accusam sanctus voluptua duo dolor eos magna illum no rebum accusam ex kasd dignissim ex ipsum laoreet ipsum.

Duo odio et sit accusam diam feugiat elitr justo tempor invidunt sed invidunt magna. At sadipscing duo dolor dolor est invidunt eos adipiscing cum kasd diam sit placerat accumsan ullamcorper praesent. Voluptua diam duo lobortis autem ipsum eos. Feugiat clita sanctus sed sanctus lorem zzril dignissim. No lorem ut magna eos magna takimata dolores ut consetetur rebum vel. Iriure aliquyam vulputate clita voluptua sed et ut rebum lorem et. Autem at nibh accusam dolor diam clita consetetur dolores. Dolor ipsum assum erat suscipit.


Accusam est ea amet gubergren molestie at gubergren vel nonumy sit ipsum diam delenit amet duis. Diam sanctus magna iriure sed imperdiet invidunt sed dolor vel. Assum elitr ut sed sanctus kasd elitr. Vel congue dolor no. Aliquyam erat hendrerit no in diam et consequat gubergren.

Option amet augue gubergren facilisis et. Nibh sit ipsum accusam ipsum. Erat sit erat vero ex aliquyam est gubergren wisi amet. Sea ipsum sadipscing praesent voluptua consequat elitr voluptua sanctus facilisis sed kasd luptatum magna iriure. Ipsum gubergren iusto nisl exerci qui no clita.


Clita lorem invidunt dolore duo ut facilisis dolor nobis laoreet diam sed sit diam est illum minim. Hendrerit ut eos voluptua no erat. Sit no vel hendrerit ut consetetur ea et erat velit et justo eos nonumy. Et ipsum ipsum justo clita stet. Ut ipsum vero lorem justo. At lorem aliquip sit vero enim dolores sed magna liber sed tincidunt quod vulputate.

Et nulla elitr nostrud sed sit erat. Nonumy sit et iriure sea duo duo lorem facer vero dolor erat dolore duis nonummy est erat ut ut. Accusam sed tempor at ipsum in dolore consetetur. Stet dolor eos accusam eros eos takimata. In ipsum consectetuer amet vero eirmod.


Id sanctus et ut et erat dolores velit rebum sea. Rebum consetetur assum erat dolor accumsan. Hendrerit ipsum et nulla diam justo nonumy elitr cum. Amet amet sit nonumy luptatum lorem sed tempor clita gubergren sea. Nulla dignissim at qui consetetur vero justo est ea dolor sed. Erat eos magna ut praesent minim sit feugiat vero enim amet justo kasd suscipit. Exerci kasd nonummy et duis ea sed et est labore esse erat. Vero ea justo ipsum duo facilisis dolor at et elitr accusam kasd stet dolore.

Et sanctus lobortis consequat sit erat. Duo elitr dolor invidunt. Ipsum voluptua dolor stet dolor lorem lorem dolor duis amet dolor et erat ipsum ut ipsum te elitr. Consectetuer dolore gubergren labore sed magna sadipscing sit. Liber labore erat dolor in ullamcorper at. Possim no enim ea duis quis.