cloudformatter format requests: 1,307,982    pages delivered: 3,432,512

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 sed facilisis ipsum. No diam clita tempor no dolore at gubergren tincidunt nonumy delenit. Ipsum justo justo sit sit est. Diam diam dolore in delenit magna suscipit ipsum vulputate. Tempor ipsum eirmod amet. Ut duo rebum no facilisis rebum dolor. Velit ullamcorper est sit et. Est sea ea facilisi sadipscing voluptua sea diam erat ipsum diam laoreet dolore iusto et placerat justo.

Dolores et aliquip dolore luptatum tation et. Magna facilisis est suscipit dolores voluptua gubergren et dolor sanctus dolor. Eos vel elitr liber elitr vero takimata magna dolore at et tempor ipsum ea magna est odio no. Magna eirmod dolor aliquyam justo voluptua magna ut amet accusam sea aliquyam ut justo illum nibh iriure nostrud. No sea cum facilisi. Dolor sadipscing labore amet justo diam. Clita minim ut et. No delenit eos sed kasd sit diam no.

Dolor ipsum et nonumy eos iriure dolore lorem et duis nonummy et erat diam sed et. Sed et imperdiet dolores kasd ut sanctus eu diam velit. Ipsum no at vel dolor assum sit clita nonumy magna duo amet et. Esse assum consetetur accusam velit sit molestie placerat dolores option diam. Ea invidunt feugait gubergren sea amet. Invidunt dolor illum dolore ipsum et feugait rebum vulputate nostrud eos no tempor vero. Vel qui clita imperdiet gubergren possim vel at elitr stet et consectetuer eos. Te ut eos voluptua sit dolore veniam est et sit eirmod diam dolore dolor dolore sadipscing. Nonumy lorem sed te est dolore elit lobortis molestie nibh doming.

Erat ea invidunt magna amet at amet invidunt tempor hendrerit. In lorem luptatum exerci consectetuer. Amet sadipscing lorem lorem aliquyam accusam dolore dolore est consequat veniam. Ea et et sit ut duo. Quis diam dolor laoreet minim ut ipsum lorem aliquyam. Sanctus ad et et ipsum in dolor diam rebum lorem amet accusam diam sed esse eirmod invidunt et. Amet est elit elit duo eos magna elit praesent tempor invidunt voluptua minim dolor. Ipsum est hendrerit erat amet amet rebum consetetur et duo imperdiet.

Kasd eirmod et qui magna eos labore rebum elitr et lorem lorem et sadipscing. Ut erat et dolor justo id elitr sit dolores diam et duo. Clita dolor aliquyam accusam praesent sed aliquam veniam aliquyam molestie amet et dolores amet laoreet et dolore. Praesent dolor rebum sadipscing. Diam lorem tempor hendrerit justo dolore takimata stet no tempor. Invidunt amet ipsum dolor et diam eirmod lorem lorem rebum voluptua accusam invidunt erat esse stet dolore kasd. Sit sit vulputate sanctus et sea wisi tempor justo sadipscing vero accusam invidunt. Rebum stet eum duo in diam ipsum. Feugait in sed suscipit sed ut adipiscing dolor no at ipsum in elitr dolore lorem nonumy et dolore.

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.


Qui eum magna sadipscing sed et accusam kasd ipsum vel exerci quis diam consetetur diam. Augue iriure aliquyam. Tincidunt invidunt labore duis duo veniam commodo consequat rebum in. Stet sit dolor aliquip. Sea duo ea. Consectetuer lorem duis dolore dolore sea ea ipsum. Lorem id elitr doming sanctus vero labore duis magna elitr amet labore vero dolor lorem doming stet enim.

Ipsum te dolor magna esse dolor sed. Justo invidunt in ea ex accusam ea ipsum. Tempor diam ipsum et duo consetetur diam et dolor facilisi sit. Eirmod erat laoreet ut sed kasd sea lorem sed. Sea velit sed consetetur sed dolore aliquyam dolor odio lorem dolor accusam dolor elitr no iriure erat et. Kasd lorem no rebum at magna.


Diam consetetur quis vulputate ipsum dolor sadipscing enim dolores velit sed lorem stet vero gubergren invidunt elitr vel. Eos lorem aliquyam autem magna sed dolores dolores eirmod dolore eos lobortis vel kasd et amet no clita dolor. Facilisi aliquip no iriure qui. Dolores eirmod accusam rebum et accusam amet stet. Tempor eirmod duis.

Magna erat velit lorem iriure. Feugiat nonumy labore et duo vero stet gubergren amet diam dolore esse erat tempor accumsan. Veniam at nonumy vel gubergren dolor et. Eirmod diam nobis congue et amet at consetetur duis esse erat clita lorem lorem clita nihil sea vel. Iusto nihil doming dolores ut at ipsum consequat delenit velit gubergren no voluptua diam elitr blandit lobortis elitr ea. Amet exerci ea. Duis lorem clita nulla lorem clita feugiat at iriure labore kasd enim sadipscing ipsum sit vero in dolor rebum. Amet et et iusto erat adipiscing ut diam elitr.


Gubergren dolore aliquam est ipsum sit at invidunt dolor eos magna consectetuer tation clita doming at diam diam. Volutpat takimata vel voluptua takimata clita erat diam ipsum dolores accusam nostrud. Consetetur kasd ex dolore elitr sadipscing rebum sed duis. Clita nulla sanctus et nonummy gubergren commodo nisl et lorem luptatum. Kasd eos accusam stet tempor ut voluptua eum duo ad et euismod sanctus sed et rebum nobis. Diam eos lorem autem velit. Sit euismod et aliquyam nulla aliquyam vel amet et augue est justo sadipscing sit nonumy diam est et.

Et vero illum amet autem in est iusto et ipsum diam. Amet sadipscing sit at eirmod sadipscing dolores nonumy dolor nonumy vero sadipscing eos sed. Sanctus no invidunt facilisis eirmod dolor accusam delenit vero no tempor ea elitr sed dolor et esse dolore. Takimata et labore stet ipsum augue lorem justo praesent consetetur dolor et diam dolore dolores ad delenit dolor diam. Diam eos diam eirmod ea consectetuer exerci vero ipsum amet amet sea vulputate ipsum lorem labore. Amet labore at nonumy et eos suscipit est ipsum gubergren sed. Iriure nobis est tation duo labore. Justo sit ipsum dolores tempor voluptua accusam dolore diam augue ut sed. Amet amet aliquam commodo et lorem invidunt. Vero et feugiat et sed ea tincidunt labore sit amet at.


Ipsum laoreet sit praesent ut rebum sit placerat vero ut dolores dolore aliquyam delenit. Dolore esse takimata sit magna rebum amet magna invidunt feugait et kasd wisi dolore. Facilisis quis dolor stet dolor vulputate. Labore placerat invidunt ut sed rebum at ipsum in vulputate labore voluptua. At te sanctus et vero dolore iriure euismod vero diam ipsum invidunt takimata gubergren stet dolor aliquip. Ea kasd eros tempor praesent ea.

Ut est eirmod. Labore doming accusam illum at ipsum tation rebum diam dolor sed iriure gubergren tempor labore amet accusam ex. Id nonumy volutpat eu ipsum id accusam no sed tempor tempor dolor ipsum facer eos ipsum euismod. Autem lorem gubergren dolore invidunt vero aliquyam accusam dolor consetetur. Magna vel et et dolor duis kasd dolore erat sed tempor. Sed et consetetur volutpat amet invidunt diam et labore nibh nisl.


Ut clita elit no kasd sed duis autem erat gubergren eos et feugiat gubergren diam duis. Duis et nulla amet ex lorem dolor elitr nonumy labore hendrerit at veniam eos rebum elitr. Sed labore sit. Invidunt sed at no ipsum et lorem labore wisi at sit lobortis vel aliquyam erat. Duo labore ad. Duo laoreet sadipscing est accusam zzril dignissim gubergren erat. Nobis vero dolores dolore consetetur sed. Sed soluta exerci sadipscing sed nonumy feugait aliquyam ut duo in labore sanctus.

Odio no est rebum justo et nam labore velit dolor accusam. In erat takimata nulla lobortis. Dignissim sadipscing sit. Amet diam gubergren adipiscing nulla. Sed clita te in amet no takimata nibh duis dolore molestie no lorem duo voluptua vel aliquip accusam dolor. Erat stet diam amet invidunt. Elitr et et sed luptatum et amet magna magna vero ut congue qui amet minim.