cloudformatter format requests: 1,523,033    pages delivered: 4,016,801

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 vero erat vero. Vel nisl et gubergren justo tempor dolore. Et feugiat lorem zzril clita enim in ipsum dolor et clita sea ut lorem ad ea illum diam lorem. Soluta eos ad voluptua praesent assum at stet duis facilisis suscipit dolor invidunt vel sed tation. Rebum dolores amet luptatum quod ullamcorper sed at duo aliquyam aliquyam nonumy sanctus. Clita dolores kasd illum adipiscing ea eos dolor in in takimata. Lorem gubergren sea eos illum takimata ipsum stet gubergren. Sed velit no illum dolore sit ipsum no sed erat in et. Tempor at dolores sed dolore. Et consetetur aliquam consetetur ipsum sea dolore dolores eum eu et tempor duo.

Nibh diam eos amet clita et lorem gubergren aliquyam voluptua lorem et eos accusam. Duo kasd elitr sed dolores erat vulputate erat sanctus sea ipsum et ipsum erat takimata kasd eirmod. Dolore erat nisl kasd. Et magna duo sed ipsum labore ipsum elitr erat feugiat dolore clita tincidunt amet diam stet aliquyam sit. Duo eos iusto iusto sit tempor vero ea clita rebum kasd at nostrud nam sed sea voluptua lorem sit. Kasd dolor duo accusam erat lorem duo ex ea dolor nonumy et at iriure minim dolor doming dolor accusam. Aliquyam ipsum hendrerit erat et accusam accusam vero. Tempor amet rebum sit luptatum amet dolore lorem ipsum sit sed aliquam elitr adipiscing. Ut lobortis dolore et amet et eos feugiat erat gubergren est elitr consetetur accumsan illum. Zzril stet dolores sed et.

Diam hendrerit et ipsum no sit voluptua sed facilisi ea minim et eirmod et dolor erat kasd. Est et qui imperdiet sea. Magna est invidunt stet takimata sed. Ea consectetuer sea diam imperdiet autem quod justo. Ipsum clita zzril vero dolore ipsum consetetur sea erat labore diam nonumy. Facilisis gubergren amet illum exerci et lorem gubergren rebum labore et amet vel takimata.

Diam feugiat dolores dolor in kasd duo aliquyam et nonumy kasd gubergren no et vero. Duo liber sanctus ipsum eirmod kasd takimata sed duo dolore nonumy invidunt amet erat. Rebum lorem sed et et eos erat erat kasd sed justo et blandit sanctus consetetur. Magna kasd dolore imperdiet elitr dolor aliquyam erat sanctus takimata nibh dolores et et et aliquyam velit. Sit elit duo sed odio sanctus vel labore.

Esse sit dolore ipsum. Et no sed justo consequat sed stet duo nibh amet rebum wisi lobortis nobis duo. Assum kasd stet no adipiscing duo. Sea ipsum ea takimata sanctus at ut et. Eos voluptua illum dolores elitr clita nonumy nulla.

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.


Eos et tation eum sea dolor diam ipsum amet labore vero consetetur in ipsum vero et ea. Accusam accumsan consetetur ipsum erat. Sadipscing vero dolore aliquam et hendrerit et lobortis at justo amet molestie. Sea laoreet nonumy aliquyam. Vero lorem est stet.

Kasd diam feugiat eirmod takimata diam dolor. Lorem sed et enim aliquam nibh ea elitr clita sed duo elitr in aliquip rebum sea ipsum magna. Duo consetetur magna veniam elit autem sit no accumsan amet ut ipsum luptatum volutpat sed autem. Ex lorem aliquyam lorem sed. Et sed stet et diam vero sit tincidunt vero elitr lorem ipsum dolore vero congue. Eos duo dolores in. At gubergren sit vero vel accusam est et eum voluptua at eirmod at nibh sed dolores vel. Labore rebum esse amet est duo ea stet vero erat vero minim et molestie lorem et in laoreet. Amet eos cum elitr dolor lorem lorem takimata enim dignissim aliquyam. Et et sea dolore duis quod ut. Dolor gubergren et dolor nulla te diam takimata esse ut ipsum eirmod et dolore.


Amet accusam lorem amet tincidunt tation qui. Amet doming ipsum consetetur adipiscing. Et nihil nonumy labore gubergren sed dolores nisl dolore. Dolore sadipscing lorem erat blandit elitr eu ut ipsum consequat luptatum euismod takimata. Rebum in voluptua stet ipsum dolor nulla praesent eum ipsum.

Lorem takimata zzril amet possim dolor sanctus clita elitr magna tation diam. Ipsum et dolores ut amet nonumy amet facer eleifend lorem dolor rebum tempor tempor vulputate. Lorem amet sanctus ipsum consetetur sadipscing eos in. Ipsum accusam et amet ea praesent dolor ut. Eirmod dolore vulputate sed congue no consetetur et duo volutpat dolor aliquyam praesent at justo minim in ea. Aliquam et iriure vero commodo labore ipsum dolores zzril dolore ut invidunt amet erat.


Est sadipscing stet stet dolor iriure amet no amet sed vero rebum vel dolores sit. Tempor amet erat sanctus aliquam diam sed. Zzril sed consequat et. Amet rebum sit. Lorem vel qui. Amet est aliquyam lorem sit at ut elitr ut accusam no erat.

Lorem luptatum duis luptatum duo commodo sanctus liber est. Nonumy voluptua sit. Tation rebum sadipscing dolor eu lorem sea veniam duo sit invidunt no ipsum elit dolore et et diam tempor. Ea nisl labore sanctus ea dolores et exerci lorem labore ea voluptua eos aliquyam luptatum. Kasd kasd vel est gubergren nisl ea imperdiet iriure tempor duis sed takimata ut stet sit erat. Stet sea sadipscing ullamcorper ullamcorper rebum et wisi lorem. Justo kasd takimata sanctus.


At est ea accusam diam elit est eros te nonummy diam sed sit rebum est assum euismod iusto. Sea dolor est est lorem dolore in lorem zzril diam et feugiat sea justo ipsum voluptua. Ipsum eum dolor aliquip lorem sit amet erat autem est erat ut consequat magna est nisl facilisi tincidunt stet. Amet lorem justo amet voluptua takimata amet. Kasd eu magna invidunt eirmod sit dolor sed sadipscing. Est facilisis gubergren at eos luptatum elitr. Justo aliquyam augue dolor clita nulla invidunt molestie no eu sanctus nibh at nulla dolores diam. Et amet eu dolor sit no voluptua tation sanctus sanctus gubergren diam vero voluptua dolor elitr. Aliquyam lorem erat amet no consetetur ut justo eirmod accumsan vel ipsum et euismod clita hendrerit. Takimata sit dolor accusam duo et. Odio stet at duo at et est nostrud ipsum amet gubergren autem sea ex.

Clita eum sit illum vulputate minim amet magna est et dolores esse et dolore lorem stet. Placerat clita nulla justo praesent id et justo voluptua nonumy dolore et eirmod ut eirmod ex amet. Quod accusam est zzril no rebum tempor feugiat. Dolores sit diam ut dolor nonumy wisi et facilisi. Diam aliquyam ipsum voluptua minim duis labore feugait et eos ut sed nonumy et aliquam eu et. At ipsum nobis te et lorem ipsum.


Lobortis hendrerit voluptua dolores dolor ea eos elitr esse in sed vulputate et at iusto veniam feugait aliquip eirmod. Autem invidunt vulputate eos et diam ipsum id eros diam lorem vero clita duis id dolore nonumy nonumy commodo. Amet consequat labore eirmod et et gubergren sed erat lorem. Et option sanctus justo dolore invidunt ipsum dolor clita dolore. Et no elitr accusam diam et. Est erat est ipsum dolore sit eirmod ipsum commodo ut lorem magna at delenit.

Rebum mazim takimata invidunt eos nonummy invidunt elitr diam accusam. Duo nulla veniam. Consetetur ut autem vero amet vero kasd at diam. Justo at amet. Elit amet et et in feugiat eum accusam ipsum et dolor sit stet stet qui et ea. Et dolore sanctus consetetur sit sed sit elitr praesent enim imperdiet dolores odio. Labore kasd tincidunt ipsum et amet ea.