« Programmation XML/XSL-FO » : différence entre les versions

Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
DannyS712 (discussion | contributions)
m <source> -> <syntaxhighlight> (phab:T237267)
Aucun résumé des modifications
Ligne 66 : Ligne 66 :
{| cellpadding="0" cellspacing="0" width="60%" border="0" align="center"
{| cellpadding="0" cellspacing="0" width="60%" border="0" align="center"
|- <!-- 1ère ligne -->
|- <!-- 1ère ligne -->
| colspan="4" style="border-left: 1px solid black; border-top: 1px solid black;" align="center" | ''Page viewport area''
| colspan="4" style="border-left: 1px solid ; border-top: 1px solid ;" align="center" | ''Page viewport area''
| colspan="3" style="border-top: 1px solid black; border-right: 1px solid black;" width="50%" | I margin-top
| colspan="3" style="border-top: 1px solid ; border-right: 1px solid ;" width="50%" | I margin-top
|- <!-- 2ème ligne -->
|- <!-- 2ème ligne -->
| width="5%" style="border-left: 1px solid black; border-right: 1px dashed black;" | &#160;
| width="5%" style="border-left: 1px solid ; border-right: 1px dashed;" | &nbsp;
| colspan="5" style="border-top: 1px dashed black; border-bottom: 1px solid black; " align="center" | region-before<br/>region viewport area
| colspan="5" style="border-top: 1px dashed; border-bottom: 1px solid ; " align="center" | region-before<br/>region viewport area
| width="5%" style="border-left: 1px dashed black; border-right: 1px solid black;" | &#160;
| width="5%" style="border-left: 1px dashed; border-right: 1px solid;" | &nbsp;
|- <!-- 3ème ligne -->
|- <!-- 3ème ligne -->
| width="5%" style="border-left: 1px solid black; border-right: 1px dashed black;" | &#160;
| width="5%" style="border-left: 1px solid ; border-right: 1px dashed ;" | &nbsp;
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid ;" | &nbsp;
| colspan="3" style="border-right: 1px solid black;" | &#160;<br/>&#160;
| colspan="3" style="border-right: 1px solid ;" | &nbsp;<br/>&nbsp;
| width="5%" style="border-right: 1px dashed black;" | &#160;
| width="5%" style="border-right: 1px dashed;" | &nbsp;
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid ;" | &nbsp;
|- <!-- 4ème ligne -->
|- <!-- 4ème ligne -->
| width="5%" style="border-left: 1px solid black; border-right: 1px dashed black;" align="center" | ___<br/>[[Image:Point rouge.gif|margin-left]]
| width="5%" style="border-left: 1px solid ; border-right: 1px dashed ;" align="center" | ___<br/>[[Image:Point rouge.gif|margin-left]]
| width="5%" style="border-right: 1px solid black;" align="center" | [[Image:Point rouge.gif|Region-start - region viewport area]]
| width="5%" style="border-right: 1px solid ;" align="center" | [[Image:Point rouge.gif|Region-start - region viewport area]]
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid ;" | &nbsp;
| width="60%" style="border-right: 1px solid black; border-top: 1px solid black; border-bottom: 1px solid black;" bgcolor="lightyellow" align="center"| &#160;<br/><br/>Region-body<br/>region viewport area<br/><br/>&#160;<br/><br/>&#160;<br/><br/>&#160;
| width="60%" style="border-right: 1px solid ; border-top: 1px solid ; border-bottom: 1px solid ;background-color:#ffcf8340;text-align:center;"| &nbsp;<br/><br/>Region-body<br/>region viewport area<br/><br/>&nbsp;<br/><br/>&nbsp;<br/><br/>&nbsp;
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid ;" | &nbsp;
| width="5%" style="border-right: 1px dashed black;" align="center" | [[Image:Point rouge.gif|Region-end - region viewport area]]
| width="5%" style="border-right: 1px dashed;" align="center" | [[Image:Point rouge.gif|Region-end - region viewport area]]
| width="5%" style="border-right: 1px solid black;" align="center" | ___<br/>[[Image:Point rouge.gif|margin-right]]
| width="5%" style="border-right: 1px solid ;" align="center" | ___<br/>[[Image:Point rouge.gif|margin-right]]
|- <!-- 5ème ligne -->
|- <!-- 5ème ligne -->
| width="5%" style="border-left: 1px solid black; border-right: 1px dashed black;" | &#160;
| width="5%" style="border-left: 1px solid ; border-right: 1px dashed ;" | &nbsp;
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid ;" | &nbsp;
| colspan="3" style="border-right: 1px solid black;" | &#160;<br/>&#160;
| colspan="3" style="border-right: 1px solid ;" | &nbsp;<br/>&nbsp;
| width="5%" style="border-right: 1px dashed black;" | &#160;
| width="5%" style="border-right: 1px dashed;" | &nbsp;
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid ;" | &nbsp;
|- <!-- 6ème ligne -->
|- <!-- 6ème ligne -->
| width="5%" style="border-left: 1px solid black; border-right: 1px dashed black;" | &#160;
| width="5%" style="border-left: 1px solid ; border-right: 1px dashed ;" | &nbsp;
| colspan="5" style="border-top: 1px solid black; border-right: 1px dashed black; border-bottom: 1px dashed black; " align="center" | region-after<br/>region viewport area
| colspan="5" style="border-top: 1px solid ; border-right: 1px dashed ; border-bottom: 1px dashed; " align="center" | region-after<br/>region viewport area
| width="5%" style="border-right: 1px solid black;" | &#160;
| width="5%" style="border-right: 1px solid;" | &nbsp;
|- <!-- 7ème ligne -->
|- <!-- 7ème ligne -->
| colspan="4" style="border-left: 1px solid black; border-bottom: 1px solid black;" align="center" | &#160;
| colspan="4" style="border-left: 1px solid; border-bottom: 1px solid ;" align="center" | &nbsp;
| colspan="3" style="border-bottom:1px solid black; border-right: 1px solid black;" | I margin-bottom
| colspan="3" style="border-bottom:1px solid; border-right: 1px solid ;" | I margin-bottom
|-
|}
|}



Version du 10 octobre 2021 à 13:08

Processus de création d'un document de présentation.

Introduction à XSL-FO

XSL-FO (eXtensible Stylesheet Language - Formatting Objects) dans la recommandation XSL du W3C est le vocabulaire qui décrit les mises en forme de documents XML quel que soit le support : écran, papier mais aussi dispositifs mobiles ou audio...

XSL-FO est un langage d'une haute technicité qui s'adresse principalement aux typographes afin de fournir avec les outils de gestion de documents, un outil typographique du niveau attendu par les publications imprimées.

L'objectif de XSL-FO est de créer un arbre d'aires où une aire est une zone d'affichage (visuelle ou auditive).

Les aires sont de deux types :

  • Les aires de blocs s'empilent les unes sur les autres,
  • Les aires en-ligne s'empilent les unes à côté des autres.

XSL-FO fournit l'ensemble des commandes de contrôle de chaque aire : présentation du contenu, direction de l'empilement (écriture de gauche à droite ou inversement, de haut en bas...).

Ces commandes sont dans des balises <fo: et on les enregistre dans des documents .xfo, .fo ou .fob.

Un document "Bonjour le monde"

Le résultat du code suivant est Hello world[1] :

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

 <fo:layout-master-set>
  <fo:simple-page-master master-name="A4">
    <fo:region-body />
  </fo:simple-page-master>
 </fo:layout-master-set>

 <fo:page-sequence master-reference="A4">
  <fo:flow flow-name="xsl-region-body">
    <fo:block>Hello world</fo:block>
  </fo:flow>
 </fo:page-sequence>

</fo:root>

Le modèle des aires

Modèle d'une page simple

Format du tableau :

 ------------------------------------      -- 
 |                                  |       1
 |    ------------------------      |      --
 |    |                      |      |       2
 |    ------------------------      |      --
 |    |    |            |    |      |       3
 |    |    |    ------- |    |      |      --
 |    |    |    |     | |    |      |       4
 |    |    |    |     | |    |      |        
 |    |    |    |     | |    |      |       
 |    |    |    |     | |    |      |       
 |    |    |    ------- |    |      |      --
 |    |    |            |    |      |       5
 |    ------------------------      |      --
 |    |                      |      |       6
 |    ------------------------      |      --
 |                                  |       7
 ------------------------------------      -- 

 | 1  | 2 |   3 | 4  |5|  6  |  7   |
Page viewport area I margin-top
  region-before
region viewport area
 
     
 
   
___
margin-left
Region-start - region viewport area    

Region-body
region viewport area

 

 

 
  Region-end - region viewport area ___
margin-right
     
 
   
  region-after
region viewport area
 
  I margin-bottom

L'affinage et la résolution des propriétés

Les objets de mise en forme

Les propriétés de mise en forme

Références

  1. http://www.w3schools.com/xslfo/xslfo_output.asp

Liens externes

La dernière vérification concernant les liens externes a été effectuée le le 25 janvier 2006.

  • (anglais) w3.org Recommandation du W3C.
  • (français) yoyodesign.org Traduction de la recommandation du W3C version 1.0 du 15 octobre 2001.
  • (anglais) w3schools.com Apprendre XSL-FO avec w3schools (tutorial, documentation...)
  • (anglais) xml.apache.org FOP, le moteur XSL-FO d'Apache
FOP est une application Java qui accepte un document FO et génère une page dans différents formats : PDF, PCL, PS, SVG, XML, Print, AWT, MIF and TXT. Le principal format de sortie étant le PDF.