Téléchargement des produits


Version anglaise


 


Cette bibliothèque regroupe un certain nombre de macros permettant de définir un document au format XSL-FO. Ces directives doivent être appelées en précisant l'espace de noms "hardisFo" :

<@hardisFo.toolMacro parameters>...</@hardisFo.toolMacro>
${ hardisFo.toolFunction(...) } 


Chaque macro de nom hardisFo.foXXX représente en langage XSL-FO la balise <fo:XXX>.

Lors du traitement d'un template, l'exécution d'une macro hardisFo.foXXX produira dans le document résultat le fragment de code XSL-FO suivant : <fo:XXX ...> ... </fo:XXX>.


Chaque appel de macro hardisFo.foXXX doit être correctement imbriqué dans la bonne macro hardisFo.foXXX parente, comme spécifié par le langage XSL-FO.

Par exemple, la spécification XSL v1.1 impose qu'une balise <fo:flow> ne peut être placée qu'à l'intérieur d'une balise <fo:page-sequence>, donc la macro hardisFo.foFlow ne pourra être appelée que dans le contenu imbriqué d'une macro hardisFo.foPageSequence.


Seules les balises XSL-FO supportées par le moteur Apache FOP 2.2 ont été portées (cliquez ici pour plus de détails).



Convention de nommage des macros hardisFo.foXXX 

A chaque balise XSL-FO <fo:XXX> correspond une macro hardisFo.foXXX.

La règle de renommage est la suivante : le nom de balise XXX est converti de sa notation Kebab case en notation Camel case.


Tableau de correspondances :

Balise XSL-FO

Macro hardisFO

basic-link

hardisFo.foBasicLink

bidi-override

hardisFo.foBidiOverride

block

hardisFo.foBlock

block-container

hardisFo.foBlockContainer

bookmark

hardisFo.foBookmark

bookmark-title

hardisFo.foBookmarkTitle

bookmark-tree

hardisFo.foBookmarkTree

character

hardisFo.foCharacter

color-profile

hardisFo.foColorProfile

conditional-page-master-reference

hardisFo.foConditionalPageMasterReference

declarations

hardisFo.foDeclarations

external-graphic

hardisFo.foExternalGraphic

float

hardisFo.foFloat

flow

hardisFo.foFlow

footnote

hardisFo.foFootnote

footnote-body

hardisFo.foFootnoteBody

inline

hardisFo.foInline

inline-container

hardisFo.foInlineContainer

instream-foreign-object

hardisFo.foInstreamForeignObject

layout-master-set

hardisFo.foLayoutMasterSet

leader

hardisFo.foLeader

list-block

hardisFo.foListBlock

list-item

hardisFo.foListItem

list-item-body

hardisFo.foListItemBody

list-item-label

hardisFo.foListItemLabel

marker

hardisFo.foMarker

multi-case

hardisFo.foMultiCase

multi-switch

hardisFo.foMultiSwitch

page-number

hardisFo.foPageNumber

page-number-citation

hardisFo.foPageNumberCitation

page-number-citation-last

hardisFo.foPageNumberCitationLast

page-sequence

hardisFo.foPageSequence

page-sequence-master

hardisFo.foPageSequenceMaster

region-after

hardisFo.foRegionAfter

region-before

hardisFo.foRegionBefore

region-body

hardisFo.foRegionBody

region-end

hardisFo.foRegionEnd

region-start

hardisFo.foRegionStart

repeatable-page-master-alternatives

hardisFo.foRepeatablePageMasterAlternatives

repeatable-page-master-reference

hardisFo.foRepeatablePageMasterReference

retrieve-marker

hardisFo.foRetrieveMarker

retrieve-table-marker

hardisFo.foRetrieveTableMarker

root

hardisFo.foRoot

simple-page-master

hardisFo.foSimplePageMaster

single-page-master-reference

hardisFo.foSinglePageMasterReference

static-content

hardisFo.foStaticContent

table

hardisFo.foTable

table-body

hardisFo.foTableBody

table-cell

hardisFo.foTableCell

table-column

hardisFo.foTableColumn

table-footer

hardisFo.foTableFooter

table-header

hardisFo.foTableHeader

table-row

hardisFo.foTableRow

title

hardisFo.foTitle

wrapper

hardisFo.foWrapper

↑ Haut de page


Convention de nommage des paramètres des macros hardisFo.foXXX

Chaque attribut d'une balise <fo:XXX> correspond à un paramètre de la macro correspondante hardisFo.foXXX. La règle de renommage est la suivante : le nom d'un attribut est converti de sa notation Kebab case en notation lower Camel case.

Par exemple : la balise <fo:static-content> possède un attribut de nom "flow-name". Dans la macro hardisFo.foStaticContent correspondante, l'attribut est représenté par le paramètre "flowName".

Attention : la valeur affectée à un paramètre doit être d'un type automatiquement convertible en chaîne alphanumérique par Freemarker.


Cas spéciaux :

Certains attributs XSL-FO possèdent des caractères "." ou ":". Par exemple block-progression-dimension.optimum, fox:border-radius.

La règle impose que le caractère "." soit converti en chaîne "Dot" et que le caractère ":" soit converti en chaîne "Colon". Par exemple, "block-progression-dimension.optimum" est converti en "blockProgressionDimensionDotOptimum" et "fox:border-radius" est converti en "foxColonBorderRadius".


Exemple de template de document XSL-FO écrit entièrement avec les macros :

<?xml version="1.0" encoding="utf-8"?>
<#-- XSL-FO document using hardisFo macros -->
<@hardisFo.foRoot xmlns\:fox="http://xmlgraphics.apache.org/fop/extensions">
	<@hardisFo.foLayoutMasterSet>
		<@hardisFo.foSimplePageMaster masterName="sampleLayout" pageHeight="29.7cm" pageWidth="21cm" marginTop="2.5cm" marginBottom="2.5cm" marginLeft="1cm" marginRight="1cm">
			<@hardisFo.foRegionBody/>
		</@hardisFo.foSimplePageMaster>
	</@hardisFo.foLayoutMasterSet>
	<@hardisFo.foPageSequence masterReference="sampleLayout">
		<@hardisFo.foFlow flowName="xsl-region-body">
			<@hardisFo.foBlock fontSize="14pt" border="solid red 3pt" textAlign="center" foxColonBorderRadius="5pt"> Sample of CSS use</@hardisFo.foBlock>
			<@hardisFo.foBlock>
				In this block, every inline text is <@hardisFo.foInline textTransform="uppercase">uppercase</@hardisFo.foInline>
				<@hardisFo.foBlock>
					This is the <@hardisFo.foInline textTransform="uppercase">second</@hardisFo.foInline> sentence.
				</@hardisFo.foBlock>
				<@hardisFo.foBlock>
					This is the third sentence with a particular <@hardisFo.foInline id="specialText" textTransform="uppercase" color="green">inline text</@hardisFo.foInline>.
				</@hardisFo.foBlock>
			</@hardisFo.foBlock>
		</@hardisFo.foFlow>
	</@hardisFo.foPageSequence>
</@hardisFo.foRoot>



L'utilisation dans un template des bibliothèques hardisCSS et hardisAdv impose que le document XSL-FO soit entièrement écrit à l'aide des macros hardisFo.


↑ Haut de page

  • Aucune étiquette