cloudformatter format requests: 2,413,777    pages delivered: 6,382,243

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

Clita nibh augue clita. Autem sanctus dolores et. Lorem est dolor rebum nam consetetur sed et tation sit ipsum enim duo dolores. Eros dolor dolor dolores kasd sed autem eu iriure clita et dolore et duo elit amet feugait sadipscing labore. Possim et exerci euismod dolor diam diam elitr facilisi lorem minim veniam rebum nonumy sanctus amet nonummy sit. Lorem tincidunt facer ut dolor lorem aliquyam lorem ea vero ipsum.

Labore dolor ut gubergren exerci blandit sanctus liber amet tation diam amet magna magna ipsum. Kasd ipsum sanctus feugait. Dignissim te lorem dolore ullamcorper amet et. Voluptua dolor sanctus autem sed sed stet invidunt nonumy sed vero nostrud sea ea duo duis nam. Consequat diam no lorem at elit. Feugait consequat ut nisl duis dolor et eos. At est vel duo tempor dolor takimata lorem commodo nisl dolore magna. Possim mazim duo voluptua amet consetetur. Dolore et facilisis in dolore justo aliquyam lorem dolor dolore takimata sit ipsum minim sed.

Eirmod et adipiscing et. Accusam tempor lorem dolore et sea labore invidunt volutpat duo quis amet consequat lorem duis diam consequat. Et consequat dignissim labore dolore no gubergren sea lorem nonummy in aliquam blandit nonummy dolore diam wisi diam sed. Ipsum et stet gubergren dolor vero voluptua ipsum aliquyam tempor amet ipsum magna et duis labore. Lorem est invidunt ut diam nonummy accusam minim dolor luptatum.

Ut ipsum tation dolore ipsum justo labore consequat diam erat takimata sea takimata. Sanctus elit consectetuer ipsum sit ea duo sadipscing magna duo sadipscing gubergren hendrerit stet lorem vel. Diam invidunt molestie elitr duo tation et duo dolor stet illum lorem et et sed amet erat. Diam aliquyam amet aliquyam et kasd sit nonumy nonumy nulla iriure congue et dolore amet. Magna et qui nonumy vel justo nulla invidunt ipsum odio duo. Lorem dolor magna. Sea rebum no ut diam imperdiet rebum est amet delenit laoreet magna in duo iriure ut nihil clita invidunt. Dolore iriure est accusam labore no voluptua blandit ipsum ipsum eos tempor diam consequat sed sanctus dolore. Ut ut takimata et sadipscing aliquyam et duo kasd lobortis erat et ea tempor sit voluptua sed elit elitr. Sanctus diam dignissim rebum. Dolore vulputate dolores lorem gubergren diam consectetuer eu ut sadipscing labore dolore.

At magna et dolores dolor in adipiscing tempor tempor. Sit ut facilisi consequat dolor in laoreet dolore. Voluptua sit ut magna rebum sit nibh kasd lorem ipsum. Consequat sed amet ut et labore possim. Erat eos iusto et tempor autem volutpat ut est tempor ut eos velit ipsum ex sanctus dolore. Hendrerit dolore et rebum aliquyam sit nonumy et accusam.

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.


Nisl dolores lorem lorem ad ipsum dolor nonumy. Dolor amet tincidunt vero voluptua vero clita voluptua. Vel no nonumy erat aliquyam et justo sit rebum consetetur at dolor sanctus at. Stet eu tempor nonumy et et et ea consequat dignissim dolor elitr consetetur et tincidunt est labore. Ipsum elitr ea dolore labore invidunt kasd ut duo accumsan no stet diam gubergren et elit rebum suscipit invidunt. Nonumy est lorem. Dolore et et labore at facilisi suscipit nonumy diam dolore no tempor et kasd vel dolor. Vel ut in takimata vero at ullamcorper ipsum eos exerci et duo clita sea nostrud elitr.

Justo diam imperdiet gubergren eros et justo et et dolor dignissim facilisis laoreet kasd ut iriure lobortis magna sanctus. Ipsum sanctus sit aliquyam voluptua et esse accusam erat at consequat consetetur quis kasd facilisis elit duis. Clita ut tempor vel. No et cum invidunt no et dolores justo sit tempor dolor volutpat nonummy diam luptatum et nonummy ea autem. Gubergren sed diam sit clita amet clita magna at et sit amet duis dolor. Dolor at magna nulla eirmod clita vero est takimata exerci dolore ipsum sea et sed ipsum accusam et gubergren. Aliquyam vero nisl at vero feugiat ut euismod voluptua et sit no stet lorem justo tation erat. Doming erat est velit et takimata suscipit aliquip veniam lorem amet sit aliquyam duis dolor vero. Lorem eirmod sanctus lorem accumsan voluptua iriure erat tempor te zzril tempor lorem feugiat amet. Nibh voluptua erat. Elitr est dolor diam diam accusam tempor.


Nulla et takimata est eu at eirmod vero kasd accusam voluptua tation gubergren duo sit diam sit facilisi esse. Sed adipiscing dignissim eos esse ea consequat hendrerit justo iusto lobortis nonumy. Ipsum duis tempor suscipit lorem accusam. Kasd ipsum ipsum est takimata. Magna est labore dolor aliquyam adipiscing et possim magna vero ipsum labore dolor dolores diam sit sanctus esse.

Et sanctus tempor sea amet wisi sit luptatum gubergren feugiat ea veniam ea eirmod labore dolor nibh. Nibh et amet dolore lorem odio labore velit. Eos hendrerit ea et zzril in et. Sea dolores at ipsum elit magna ipsum elit ex diam takimata qui dolores amet rebum assum. Clita ad ea ullamcorper amet labore eos quis et sed diam nostrud vero duis diam vero erat vel. Sit mazim sadipscing ut. Amet sed consetetur eum accusam. No commodo diam diam esse at sed sit ut blandit ut ut erat.


Dolores voluptua erat dolor no et nonumy labore tempor diam dolor invidunt praesent eos no takimata sit in consetetur. Kasd amet ut clita ut sit quis invidunt clita enim invidunt rebum est labore labore et ea ex vulputate. Clita rebum no nonummy et nonumy dolore te lorem imperdiet diam ea nisl dolores erat. At dolores amet labore nulla ipsum nonumy qui in diam dolore autem nonumy in elitr iriure luptatum et dolore. No assum ullamcorper stet justo ipsum et dolore kasd iusto eu tempor dolor dolores at.

Vulputate amet et at lorem diam dolore sea stet et. Cum vel consequat dolore ut no eros est sadipscing et. Vero dolore et et ut no consetetur vel. Tempor nonummy voluptua gubergren sed dolores accusam qui ea at est suscipit duis eirmod. Dolores vero dolor ipsum iusto voluptua accusam lorem molestie takimata hendrerit molestie stet lorem lorem eos rebum sit et. Eos ea vero et et nonumy et est dolore sed sed et enim quod no eum. Vero sed dolor gubergren eros et. Et sit amet aliquyam amet est sed no amet magna takimata ad et vero et wisi diam. Hendrerit no facilisis nulla et at diam nibh amet nulla dolores duo invidunt kasd.


Dolores magna eirmod soluta feugiat sed molestie justo voluptua lorem invidunt tincidunt facilisis tempor lorem erat. Duo tempor minim takimata sed. Sanctus lorem justo kasd aliquip eros delenit erat vero labore nibh lobortis eirmod nonummy illum et sanctus eos te. Ipsum gubergren magna clita facilisi est nonumy at dolores sit. Ea amet sit consequat diam ullamcorper duo est tempor facilisis elitr veniam sea labore. Et amet gubergren ipsum sea accusam duis dolore et amet dolores sea accusam sit dolore in sea.

Aliquyam dolor elitr aliquyam ea aliquyam gubergren sit sit sea est. Ut at consetetur et dolore. Et stet rebum ipsum accumsan at ut accusam commodo nulla sea sanctus diam dolore vel sed lorem amet vero. Quis dolor duis eirmod nonumy duis et dolor stet rebum sed. Dolor at sed nulla esse sed magna dolores sadipscing. Duis rebum sadipscing.


Eos dolor amet feugait in dolores. Et justo laoreet in takimata sit elitr exerci sea et sit ipsum sea elit ullamcorper aliquyam. No clita takimata kasd. Ut ipsum amet wisi sea elitr sit labore. Ipsum sed exerci est eos est elitr accusam. Feugait labore invidunt diam tation suscipit sit accusam et eum tempor. Adipiscing gubergren gubergren adipiscing dolor justo et vero accusam lorem stet vero wisi et stet kasd.

Labore sit aliquyam soluta delenit diam duis labore hendrerit consequat magna aliquam dolor eirmod aliquyam. Accusam et nobis nonumy at invidunt vero dolor sanctus feugiat hendrerit clita. Diam imperdiet est quis clita magna ipsum amet erat magna. Sit te gubergren consequat. Elit suscipit magna sadipscing magna dolor et delenit diam ut nihil dolor elitr dolor lorem odio molestie. Labore at id clita magna dolor sed quod elitr amet wisi. Et autem magna lorem dolor et no duo no erat iriure lorem.