added legi2pdf from subversion; initial svn log is copied below:

r8 | pal | 2006-10-26 15:40:23 +0200 (jeu 26 oct 2006) | 2 lines
Ajout: utilisation du paquet LaTeX "ucs" pour un support étendu de l'unicode
(#2)

r7 | pal | 2006-10-16 16:05:05 +0200 (lun 16 oct 2006) | 2 lines
Correction: typo faisant échouer la transformation (#1)

r6 | sagblmi | 2006-10-02 13:52:59 +0200 (lun 02 oct 2006) | 1 line
Nettoyage: Suppression du code inutile

r5 | sagblmi | 2006-10-02 13:37:06 +0200 (lun 02 oct 2006) | 1 line
Modification: remplacement des appels à os.system par des appels à
subprocess.call comme recommandé par Python

r4 | pal | 2006-09-22 14:57:52 +0200 (ven 22 sep 2006) | 2 lines
Fixé: oubli de "from pythonlib" devant les modules importés de pythonlib

r2 | pal | 2006-09-18 17:52:53 +0200 (lun 18 sep 2006) | 2 lines
Ajout: Import initial de legi2pdf

r1 | (pas d'auteur) | 2006-09-15 11:56:28 +0200 (ven 15 sep 2006) | 1 line
Ajout: Import de de la structure initiale
This commit is contained in:
Frédéric Péters 2008-07-08 18:00:11 +02:00
parent 4674f422a9
commit 8b51995baa
26 changed files with 4924 additions and 0 deletions

339
legi2pdf/COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

196
legi2pdf/README Normal file
View File

@ -0,0 +1,196 @@
Application - Legi2Pdf
======================
INTRODUCTION
------------
L'objectif de ce filtre est de produire un PDF qualité "imprimeur" à partir
d'un fichier LEGI (XML basé sur DocBook).
Ce filtre permet d'éviter le coût financier et un délai important pour un mise
en page "manuelle" d'un document (précédement réalisé par l'imprimeur).
=================================================================================
OUTIL
-----
Pour utiliser ce filtre il est nécessaire d'avoir:
o python 2.2 ou postérieur
o libxslt / xsltproc: librairies/application pour XML (voir http://xmlsoft.org/)
o tetex: générateur de document à partir de TEX (voir http://www.tug.org/teTeX/)
o db2latex: ensemble de spécification XSL pour transformer du DocBook en XSL
(voir http://db2latex.sourceforge.net/)
Remarque: Legi2Pdf inclue db2latex
o Ghostscript: permet d'effectuer la converssion entre du PS et du PDF
o libwmf/wmf2eps: permet d'effectuer la converssion entre du WMF et du PS
(voir: http://wvware.sourceforge.net/libwmf.html)
Pour utiliser xmf2eps sous cygwin, il est nécessaire d'avoir les modules
gd, libgd2 et libgd-devel.
=================================================================================
TEX/LATEX packages
------------------
Ils est nécessaire d'installer les modules tex/latex suivants:
o unicode
o truncate
o eurosym
o relsize
o eurosym
o footnote
o flushend (n'est plus utilisé)
o ucs
Comment installer un nouveau package TEX/LATEX ?
Pour trouver les packages:
http://www.ctan.org
Les packages non-standard à la distribution doivent (pour bien faire) être placés
dans le répertoire:
/usr/local/share/texmf/tex/latex
au lieu de
/usr/share/texmf/tex/latex
Il suffit de copier les fichiers et d'exécuter la commande: 'mktexlsr' ou 'texhash'
=================================================================================
FONTS
-----
Généralités à propos des Fonts
Remarques:
o <tex-root> == répertoire d'installation de texmf
e.g. /usr/share/texmf
o Les noms des fichiers qui sont utilisés dans la procédure correspondent
à la Font Sabon, il est relativement aisé d'extrapoler pour un autre Font
comme Univers (ex. psbb8a.afm -> punb8a.afm).
Fichiers de Font
Structure d'un nom:
p sb b [i] 8a
| | r | + encoding
| | | + italic
| | + bold or roman
| +- sabon
+- Adobe
ex. psbb8a.afm (Adobe, Sabon, Bold, 8a encoding)
punr8a.afm (Adobe, Univers, Roman, 8a encoding)
Types de fichier:
*.afm: Adobe Font Metrics
dimensions des caractères, ligatures, ...
équivalent aux fichiers *.tfm pour les fonts de type METAFONT.
*.pfa: Printer Font Ascii
*.pfb: Printer Font Binary
instructions de dessin des caractères.
(souvent payant)
*.vf: Virtual Font
Etapes pour l'installation des Fonts:
1) Copier les fichier config.psb et psb.map dans <tex-root>/dvips/psnfss
2) Créer le répertoire <tex-root>/fonts/tfm/adobe/sabon
et copier tous les fichiers avec l'extension *.tfm
3) Créer le répertoire <tex-root>/fonts/vf/adobe/sabon
et copier tous les fichiers avec l'extension *.vf
4) Créer le répertoire <tex-root>/tex/latex/sabon/tex
et copier tous les fichiers avec l'extension *.fd et le
fichier sabon.sty
5) Créer le répertoire <tex-root>/fonts/afm/adobe/sabon
et copier les fichiers:
sab____.afm, sabi____.afm, sai____.afm et sar____.afm dans le répertoire.
Renomer les fichiers:
sab____.afm -> psbb8a.afm
sabi____.afm -> psbbi8a.afm
sai____.afm -> psbri8a.afm
sar____.afm -> psbr8a.afm
6) Créer le répertoire <tex-root>/fonts/type1/adobe/sabon
et copier les fichiers:
sab____.pfb, sabi____.pfb, sai____.pfb et sar____.pfb dans le répertoire.
Renomer les fichiers:
sab____.pfb -> psbb8a.pfb
sabi____.pfb -> psbbi8a.pfb
sai____.pfb -> psbri8a.pfb
sar____.pfb -> psbr8a.pfb
7) Il faut modifier le fichier de configuration: updmap.cfg qui se trouve
dans <tex-root>/web2c
MAIS pour une distribution Linux/Debian il ne faut pas directement modifier
ce fichier mais plutot le fichier:
/etc/texmf/updmap.d/00updmap.cfg
Ajouter à fin du fichier:
# Sabon
Map psb.map
# Univers
Map pun.map
Il faut ensuite exécuter la commande 'updmap' et la commande 'mktexlsr'
8) Il faut modifier le fichier de configuration :pdftex.cfg
Ajouter la ligne "pdf_minorversion 5" pour prendre en charge le pdf1.5
=================================================================================
BABEL
-----
Comment configurer votre système pour 'supporter' le français (césure) ?
1) Pour configurer les motifs de césure pour votre langue, éditer le fichier
/etc/texmf/language.dat
Vérifier que le français est actif (pas mis en commentaire)
% French, TWO lines!
french frhyph.tex
=patois
2) Editer le fichier /etc/texmf/fmt.d/00tetex.cnf
pour que pdftex et pdflatex supporte babel:
remplacer :
'-' -> language.dat
pdftex pdftex language.dat pdftex.ini
pdflatex pdftex language.dat pdflatex.ini
3) Vérifier que 'frhyph.tex' existe bien; normalement ce fichier se
trouve dans: <tex-root>/tex/generic/hyphen/frhyph.tex
4) puis lancer :
> texconfig init ; texconfig hyphen
5) pour faire un test:
test.tex=
début >>>
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[cyr]{aeguill}
\usepackage[francais]{babel}
\begin{document}
\showhyphens{signal container \'ev\'enement alg\`ebre}
\showhyphens{signal container événement algèbre}
\end{document}
<<< fin
> pdflatex test.tex
Si vous obtenez:
[] /aer10/si-gnal contai-ner ^^e9v^^e9-ne-ment al-g^^e8bre
^^^^^^^
==> OK
Par contre si vous obtenez:
[] /aer10/sig-nal con-tainer ^^e9v^^e9ne-ment al-g^^e8bre
^^^^^^^
==> PROBLEME !!! toujours en anglais !

23
legi2pdf/lib/__init__.py Normal file
View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Tabellio -- software suite for deliberative assemblies
# -- suite logicielle pour assemblées délibératives
# -- http://www.tabellio.org/
# Copyright (C) 2006 Parlement de la Communauté française de Belgique
# This file is part of Tabellio.
# Tabellio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Tabellio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Tabellio -- software suite for deliberative assemblies
# -- suite logicielle pour assemblées délibératives
# -- http://www.tabellio.org/
# Copyright (C) 2006 Parlement de la Communauté française de Belgique
# This file is part of Tabellio.
# Tabellio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Tabellio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

View File

@ -0,0 +1,292 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Tabellio -- software suite for deliberative assemblies
# -- suite logicielle pour assemblées délibératives
# -- http://www.tabellio.org/
# Copyright (C) 2006 Parlement de la Communauté française de Belgique
# This file is part of Tabellio.
# Tabellio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Tabellio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import sys
import os
import re
import threading
import time
import string
import math
import tempfile
import getopt
import cStringIO
import shutil
import libxml2
import logging
import subprocess
from utils.legiCommon import nameContentLegi
# from pythonlib
from pythonlib.xmlutils import parseStream, applyStylesheet2, applyStylesheet
from pythonlib.epsutils import eps2pdf
from pythonlib.ziputils import unzipToDirectory
from pythonlib.utf8utils import utf8encode
from pythonlib import magic
tempfilelock = threading.Lock()
tempfile.template = "F%ld-" % time.time()
log = logging.getLogger("")
abspath = os.path.abspath(os.path.dirname(__file__))
xslpath = os.path.join(abspath,"..","..","xsl")
xslPreprocessingFilterName = os.path.join(xslpath,"pre_proc.xsl")
xslPostprocessingFilterName = os.path.join(xslpath,"post_proc.xsl")
xslMainprocessingFilterName = os.path.join(xslpath,"main.xsl")
xslAnnexPreprocessingFilterName = os.path.join(xslpath,"annex_pre_proc.xsl")
xslCopyProcessingFilterName = os.path.join(xslpath,"copy_proc.xsl")
class PdfGeneratorException:
def __init__(self,message=""):
self.message = message
def __str__(self):
return self.message
def _writeToFile(filename, data):
f = None
try:
f = open(filename, "wb")
f.write(data)
finally:
if f != None:
f.close()
def makeTempFileName(suffix="",subdir=None):
tmpd = tempfile.tempdir
tempfile.tempdir = os.path.join(tempfile.gettempdir(),"legi2pdf")
if not os.path.exists(tempfile.tempdir):
os.mkdir(tempfile.tempdir)
tempfilelock.acquire()
try:
if not subdir:
return tempfile.mktemp()+suffix
else:
old = tempfile.tempdir
tempfile.tempdir = os.path.join(old,subdir)
r = tempfile.mktemp()+suffix
tempfile.tempdir = old
return r
finally:
tempfile.tempdir = tmpd
tempfilelock.release()
def purgeDirectory(d):
try:
for f in os.listdir(os.path.abspath(d)):
os.remove(os.path.join(d, f))
os.rmdir(d)
finally:
pass
bboxRE = re.compile(r'\d+(?:\.\d+)?')
def _convertBboxVal(val):
r = bboxRE.findall(val)
f = string.atof(r[0])
return "%d" % math.floor(f + 0.5)
def unzipAnnexToDir(annexes, tempDir):
# unzip annex files
for i in range(len(annexes)):
annexeFileName = annexes[i][0]
if annexeFileName[-5:] == ".legi":
unzipToDirectory(annexeFileName, tempDir, "%d_" % i)
else:
shutil.copy(annexeFileName, os.path.join(tempDir,os.path.basename(annexeFileName)))
def getBboxes(d):
bboxDict = {}
doc = None
ctxt = None
try:
doc = libxml2.parseFile(os.path.join(d,nameContentLegi))
ctxt = doc.xpathNewContext()
res = ctxt.xpathEval("//imagedata")
for r in res:
if r.name == "imagedata":
fileNameProp = r.hasProp("fileref")
widthProp = r.hasProp("width")
depthProp = r.hasProp("depth")
if (fileNameProp and widthProp and depthProp):
bboxDict[fileNameProp.getContent()] = (
_convertBboxVal(widthProp.getContent()),
_convertBboxVal(depthProp.getContent()))
finally:
if doc != None:
doc.freeDoc()
if ctxt != None:
ctxt.xpathFreeContext()
return bboxDict
def convertWmf2Pdf(d):
bboxDict = getBboxes(d)
for wmfFileName in os.listdir(d):
if wmfFileName[-4:] == ".wmf":
epsFileName = wmfFileName[:-4] + ".eps"
pdfFileName = wmfFileName[:-4] + ".pdf"
bbox = bboxDict.get(wmfFileName, None)
if bbox != None:
cmd = "wmf2eps --bbox=%sx%s %s > %s" % (
bbox[0],
bbox[1],
os.path.join(d,wmfFileName),
os.path.join(d,epsFileName))
else:
cmd = "wmf2eps %s > %s" % (os.path.join(d,wmfFileName), os.path.join(d,epsFileName))
subprocess.call([cmd],cwd=d, shell=True)
eps2pdf(os.path.join(d,epsFileName))
def insertAnnex(xmlMainDoc, annexes, d):
xmlAnnexDoc = None
inputFile = None
bookNode = xmlMainDoc.children
try:
for i in range(len(annexes)):
#bookNode = xmlMainDoc.children
if annexes[i][0][-5:] == ".legi":
inputFile = open(os.path.join(d,"%d_%s" % (i, nameContentLegi)), "r")
xmlAnnexDoc = parseStream(inputFile, validate=0)
xslParams = {'annex-id':'%d_' % (i,), 'annex-title':'%s' % utf8encode(annexes[i][1])}
xmlAnnexDoc = applyStylesheet2( xmlAnnexDoc , xslAnnexPreprocessingFilterName, xslParams)
bookNode.addChild(xmlAnnexDoc.children)
inputFile.close()
inputFile = None
elif annexes[i][0][-4:] == ".pdf":
newNode = libxml2.newNode("appendix")
newNode.newProp("type", "pdf")
titleNode = libxml2.newNode("title")
title = annexes[i][1]
if title is not None:
title = title.encode("UTF-8")
titleNode.addContent(title)
newNode.addChild(titleNode)
pdfNode = libxml2.newNode("pdf-annex")
pdfNode.newProp("pdf-file", os.path.basename(annexes[i][0]))
scale = annexes[i][2]
pdfNode.newProp("scale", "%.2f" % (scale/100.0))
newNode.addChild(pdfNode)
bookNode.addChild(newNode)
else:
log.warn("format d'annexe non supporté %s" % annexes[i][0])
finally:
if inputFile != None:
inputFile.close()
def convertLegi2Tex(input, outputFileName, annexes, d, draft=0, toc=True, style="normal"):
xmlDoc = None
inputStream = None
outputStream = None
try:
outputStream = open(os.path.join(d, outputFileName), "w")
inputStream = cStringIO.StringIO(input)
xmlDoc = parseStream(inputStream, validate=0)
#applyStylesheet( xmlDoc , xslPreprocessingFilterName, outputStream, {})
xmlDoc = applyStylesheet2( xmlDoc , xslPreprocessingFilterName, {})
insertAnnex(xmlDoc, annexes, d)
xslParam = {}
if draft:
xslParam['with-draft-tag'] = '1'
if toc:
xslParam['with-toc'] = '1'
if style == "parchment":
xslParam['parchemin'] = '1'
if style == "bqr":
xslParam['bqr'] = '1'
xmlDoc = applyStylesheet2( xmlDoc , xslMainprocessingFilterName, xslParam)
applyStylesheet( xmlDoc , xslPostprocessingFilterName, outputStream, {})
finally:
if inputStream != None:
inputStream.close()
if outputStream != None:
outputStream.close()
"""
if tempStream != None:
tempStream.close()
"""
if xmlDoc != None:
xmlDoc.freeDoc()
def convertTex2Pdf(d, latexFileName):
cmd = "pdftex --fmt=pdflatex --interaction=nonstopmode %s" % (latexFileName)
subprocess.call([cmd], cwd=d, shell=True)
subprocess.call([cmd], cwd=d, shell=True)
subprocess.call([cmd], cwd=d, shell=True )
def convertLegi2Pdf(inputFileName, pdfFileName, latexFileName, keepLatex=0, debug=0, annexes=[], draft=0, toc=True, style="normal"):
"""
Based on input .legi document, generatePdf is responsible
to generate a PDF documents.
"""
result = []
allEntries = None
tempDir = None
f = None
try:
tempDir = makeTempFileName(".legi2pdf")
os.mkdir(tempDir)
f = open(inputFileName)
fmt = magic.fileFormat(f)
if fmt == "zip":
allEntries = unzipToDirectory(inputFileName, tempDir)
if allEntries == None:
raise PdfGeneratorException, 'Unable to open or to read the legi file: %s' % (inputFileName)
contentEntryInfo, contentEntryData = allEntries.get( nameContentLegi, (None, None))
if contentEntryInfo == None or contentEntryData == None:
raise PdfGeneratorException, 'Corrupted legi file: No %s entry' % (nameContentLegi)
elif fmt == "xml":
contentEntryData = f.read()
_writeToFile(os.path.join(tempDir, nameContentLegi), contentEntryData)
else:
raise PdfGeneratorException, 'Unsupported input format: %s (should be: xml or zip)' % (fmt)
unzipAnnexToDir(annexes, tempDir)
convertLegi2Tex(contentEntryData, "temp.tex", annexes, tempDir, draft, toc, style)
convertWmf2Pdf(tempDir)
convertTex2Pdf(tempDir, "temp.tex")
if os.path.exists(pdfFileName):
os.remove(pdfFileName)
shutil.move(os.path.join(tempDir, "temp.pdf"), pdfFileName)
if keepLatex:
if os.path.exists(latexFileName):
os.remove(latexFileName)
shutil.move(os.path.join(tempDir, "temp.tex"), latexFileName)
finally:
if tempDir != None and not debug:
purgeDirectory(tempDir)
if f != None:
f.close()

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Tabellio -- software suite for deliberative assemblies
# -- suite logicielle pour assemblées délibératives
# -- http://www.tabellio.org/
# Copyright (C) 2006 Parlement de la Communauté française de Belgique
# This file is part of Tabellio.
# Tabellio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Tabellio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Tabellio -- software suite for deliberative assemblies
# -- suite logicielle pour assemblées délibératives
# -- http://www.tabellio.org/
# Copyright (C) 2006 Parlement de la Communauté française de Belgique
# This file is part of Tabellio.
# Tabellio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Tabellio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
nameContentLegi = "contents.xml"
supportedSpeechTypes = ["TABELLIO"]
xslDefaultFilterName = "templates//xsl//xml2rtf.xsl"
tempDirPrefix = "legi2Rtf_temp_dir."
bin2hex = [ '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f']

633
legi2pdf/ref/PCFstd.cls Normal file
View File

@ -0,0 +1,633 @@
%%
%% This is file `PCFstd.cls'
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{PCFstd}[1995/06/20 Article personnel]
%%% Chargement de la classe article, avec transfert d'options
\PassOptionsToClass{a4paper}{article}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
\usepackage{eurosym}
\usepackage{threeparttable}
\usepackage{balance}
\usepackage{supertabular}
\usepackage{ifthen}
\usepackage[french]{babel}
\usepackage{pdfpages}
\usepackage[normalem]{ulem}
\usepackage{color}
\definecolor{rltblack}{rgb}{0,0,0}
% --------------------------------------
% to define the size of the margin / headers / ...
% --------------------------------------
%\newlength{\headwidth}
\setlength{\hoffset}{-0.46cm}
\setlength{\voffset}{-0.56cm}
\setlength{\textwidth}{15.9cm}
\setlength{\textheight}{24.3cm}
\setlength{\oddsidemargin}{0.66cm}
\setlength{\evensidemargin}{0.66cm}
\setlength{\topmargin}{0.1cm}
\setlength{\headheight}{0.4cm}
\setlength{\headsep}{0.6cm}
\setlength{\marginparwidth}{0cm}
\setlength{\marginparsep}{0cm}
%\setlength{\headwidth}{15.9cm}
\setlength{\columnsep}{0.8cm}
\newlength{\mytablewidth}
\newlength{\mytempvalue}
\newlength{\mytempwidth}
\newlength{\mytempdepth}
% --------------------------------------
% Environment definition to adjust left/right margins
% --------------------------------------
\newenvironment{changemargin}[2]{\begin{list}{}{
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{0pt}%
\setlength{\listparindent}{\parindent}
\setlength{\itemindent}{\parindent}
\setlength{\parsep}{0.2cm plus 1pt}
\addtolength{\leftmargin}{#1}
\addtolength{\rightmargin}{#2}
}\item }{\end{list}}
% --------------------------------------
% to define extra space between two parapgraphs
% --------------------------------------
\addtolength{\parskip}{0.2cm}
% --------------------------------------
% to define the style of the footnote mark
% --------------------------------------
\makeatletter
\renewcommand\@makefnmark{\normalfont(\@thefnmark)}
%\renewcommand\@makefntext[1]{%
% \parindent 1em%
% \noindent
% \hb@xt@1.8em{\hss\@makefnmark} #1}
\makeatother
% --------------------------------------
% Definition of itemize environment to change the left margin space and
% vertical space between items.
% --------------------------------------
\newenvironment{Itemizedlist}[1]{\begin{list}{#1}
{\setlength{\itemindent}{0pt}%
\settowidth{\labelwidth}{#1}%
\setlength{\labelsep}{0.4em}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\rightmargin}{0pt}%
\setlength{\listparindent}{0pt}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\topsep}{0pt}%
\setlength{\parsep}{\parskip}%
\setlength{\partopsep}{\parskip}%
\setlength{\itemsep}{\parskip}}}%
{\end{list}}
\newenvironment{itemizedlist1}{\begin{Itemizedlist}{---}}{\end{Itemizedlist}}
\newenvironment{itemizedlist2}{\begin{Itemizedlist}{--}}{\end{Itemizedlist}}
\newenvironment{itemizedlist3}{\begin{Itemizedlist}{-}}{\end{Itemizedlist}}
% --------------------------------------
% latex variables redefinitions
% --------------------------------------
\setlength{\columnsep}{25pt}
\addto\captionsfrench{\renewcommand{\contentsname}%
{\centerline{TABLE DES MATI\`{E}RES}}}
\addto\captionsfrench{\renewcommand{\listfigurename}%
{\centerline{TABLE DES FIGURES}}}
\addto\captionsfrench{\renewcommand{\listtablename}%
{\centerline{LISTE DES TABLEAUX}}}
\makeatletter
\newcommand{\pcfpart}[4]{%
\if@noskipsec \leavevmode \fi
\par\nobreak
\addvspace{4ex}%
\@afterindentfalse
\refstepcounter{part}%
\ifthenelse{\equal{#3}{}}{\addcontentsline{toc}{part}{\textsc{#1}}}{\addcontentsline{toc}{part}{\textsc{#1 #3}}}
{\parindent \z@ \centering
\interlinepenalty \@M
\fontfamily{pun}\fontseries{m}\selectfont
\Large\textsc{#2}%
\markboth{}{}
\ifthenelse{\equal{#4}{}}{}{\vskip 1ex\normalsize\textsc{#4}\markboth{}{}}
\par\nobreak
\rule{1.2cm}{1pt}
\markboth{}{}\par}%
\nobreak
\vskip 3ex
\@afterheading}
\newcommand{\pcfpartwithid}[4]{%
\if@noskipsec \leavevmode \fi
\par
\addvspace{4ex}%
\@afterindentfalse
\refstepcounter{part}%
\addcontentsline{toc}{part}{Partie\nobreakspace\thepart\hspace{1em} #1 #3}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont
\large\bfseries\scshape \partname\nobreakspace\thepart
\par\nobreak
\Large \bfseries \textsc{#2}%
\markboth{}{}\par
\large \bfseries \textsc{#4}%
\markboth{}{}\par
\rule{1.2cm}{1pt}
\par}%
\nobreak
\vskip 3ex
\@afterheading}
\newcommand{\bqrsection}[2]{%
\if@noskipsec \leavevmode \fi
\par
\addvspace{4ex}%
\@afterindentfalse
\refstepcounter{section}%
\addcontentsline{toc}{section}{\textsc{#1}}
{\parindent \z@ \centering
\interlinepenalty \@M
\begin{changemargin}{2cm}{2cm}
\begin{center}
\large\bfseries{#2}%
\markboth{}{}
\par\nobreak
\rule{1.2cm}{1pt}
\markboth{}{}\par%
\end{center}
\end{changemargin}
\par}%
\nobreak
\vskip 3ex
\@afterheading}
\newcommand{\bqrsubsection}[2]{%
\if@noskipsec \leavevmode \fi
\par
\addvspace{4ex}%
\@afterindentfalse
\refstepcounter{subsection}%
\addcontentsline{toc}{subsection}{#1}
{\parindent \z@
\interlinepenalty \@M
\bfseries{#2}%
\markboth{}{}%
\par}%
\nobreak
\vskip 3ex
\@afterheading}
\newcommand{\bqrpart}[4]{%
\if@noskipsec \leavevmode \fi
\par
\addvspace{4ex}%
\@afterindentfalse
\refstepcounter{part}%
\addcontentsline{toc}{part}{#1 #3}%
{\parindent \z@ \centering
\interlinepenalty \@M
\fontfamily{pun}\fontseries{m}\selectfont
\Large \bfseries \textsc{#2}%
\markboth{}{}\par
\large \bfseries \textsc{#4}%
\markboth{}{}\par
\par}%
\nobreak
\vskip 3ex
\@afterheading}
\newcommand{\bqrfigure}[1]{%
\refstepcounter{figure}%
\par%
\figurename\nobreakspace\thefigure\nobreakspace -- \nobreakspace #1%
\par\nobreak}
\newcounter{pcfannexe}
\renewcommand{\thepcfannexe}{}
\newcommand{\pcfannexe}[1]{%
\if@noskipsec \leavevmode \fi
\par\nobreak
\addvspace{4ex}%
\@afterindentfalse
\refstepcounter{pcfannexe}%
\setcounter{part}{0}%
\setcounter{section}{0}%
\setcounter{subsection}{0}%
\setcounter{subsubsection}{0}%
\setcounter{paragraph}{0}%
\setcounter{subparagraph}{0}%
\addcontentsline{toc}{part}{\textsc{#1}}
{\parindent \z@ \centering
\interlinepenalty \@M
%\begin{flushleft}\large\bfseries\textsc{Annexe\nobreakspace\thepcfannexe}\end{flushleft}%
%\par\nobreak
\fontfamily{pun}\fontseries{m}\selectfont
\Large\textsc{#1}%
\markboth{}{}
\par\nobreak
\rule{1.2cm}{1pt}
\markboth{}{}\par}%
\nobreak
\vskip 3ex
\@afterheading}
\renewcommand\section{\@startsection{section}{1}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%
{-1.25ex \@plus 1ex \@minus .2ex}%
{0.2ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\setlength{\parindent}{0.6cm}
\renewcommand\part{%
\if@noskipsec \leavevmode \fi
\par
\addvspace{4ex}%
\@afterindentfalse
\secdef\@part\@spart}
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{Partie\nobreakspace\thepart\hspace{1em} #1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >\m@ne
\large\bfseries\scshape \partname\nobreakspace\thepart
\par\nobreak
\fi
\large \bfseries \textsc{#2}%
\markboth{}{}\par}%
\nobreak
\vskip 3ex
\@afterheading}
\def\@spart[#1]#2{%
\addcontentsline{toc}{part}{#1}%
{\parindent \z@ \raggedright
\interlinepenalty \@M
\normalfont
\huge \bfseries #1\par}%
\nobreak
\vskip 3ex
\@afterheading}
\makeatother
%\newcommand{\nfont}{\fontsize{11}{12}\selectfont}
\newcommand{\nfont}{\normalsize\selectfont}
\newcommand{\sfont}{\fontsize{9}{12}\selectfont}
% --------------------------------------
% LEGISTIQUE : latex definitions
% --------------------------------------
\newcounter{legipart}
\renewcommand{\thelegipart}{\ifthenelse{\value{legipart} = 1}{PARTIE PREMI\`{E}RE}{PARTIE \Roman{legipart}}}
\newcounter{legilivre}
\renewcommand{\thelegilivre}{\ifthenelse{\value{legilivre} = 1}{LIVRE PREMIER}{LIVRE \Roman{legilivre}}}
\newcounter{legititre}
\renewcommand{\thelegititre}{\ifthenelse{\value{legititre} = 1}{TITRE PREMIER}{TITRE \Roman{legititre}}}
\newcounter{legichapitre}
\renewcommand{\thelegichapitre}{\ifthenelse{\value{legichapitre} = 1}{CHAPITRE PREMIER}{CHAPITRE \Roman{legichapitre}}}
\newcounter{legisection}
\renewcommand{\thelegisection}{\ifthenelse{\value{legisection} = 1}{SECTION PREMI\`{E}RE}{SECTION \Roman{legisection}}}
\newcounter{legisoussection}
\renewcommand{\thelegisoussection}{\ifthenelse{\value{legisoussection} = 1}{SOUS-SECTION PREMI\`{E}RE}{SOUS-SECTION \Roman{legisoussection}}}
\newcommand\legidebut{%
\setcounter{legiarticleid}{0}%
\setcounter{legipart}{0}%
\setcounter{legilivre}{0}%
\setcounter{legititre}{0}%
\setcounter{legichapitre}{0}%
\setcounter{legisection}{0}%
\setcounter{legisoussection}{0}}
\makeatletter
% Partie
% ------
\newcommand\legipart[2]{%
\stepcounter{legipart}%
\setcounter{legilivre}{0}%
\setcounter{legititre}{0}%
\setcounter{legichapitre}{0}%
\setcounter{legisection}{0}%
\setcounter{legisoussection}{0}%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2ex}%
\@afterindentfalse
\addcontentsline{toc}{section}{PARTIE \Roman{legipart} #1}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont{\thelegipart}
\par\nobreak%
\bfseries{#2}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
% Partie TOC (caution: not used!!!)
\newcommand*\l@legipart[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
% Livre
% -----
\newcommand\legilivre[2]{%
\stepcounter{legilivre}%
\setcounter{legititre}{0}%
\setcounter{legichapitre}{0}%
\setcounter{legisection}{0}%
\setcounter{legisoussection}{0}%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2ex}%
\@afterindentfalse
\addcontentsline{toc}{section}{LIVRE \Roman{legilivre}\hspace{1em}#1}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont{\thelegilivre}
\par\nobreak%
\bfseries{#2}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
% Livre TOC (caution: not used!!!)
\newcommand*\l@legilivre[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
% Titre
% -----
\newcommand\legititre[2]{%
\stepcounter{legititre}%
\setcounter{legichapitre}{0}%
\setcounter{legisection}{0}%
\setcounter{legisoussection}{0}%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2ex}%
\@afterindentfalse
\addcontentsline{toc}{section}{TITRE \Roman{legititre} #1}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont{\thelegititre}
\par\nobreak%
\bfseries{#2}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
% Titre TOC (caution: not used!!!)
\newcommand*\l@legititre[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
% Chapitre
% --------
\newcommand\legichapitre[2]{%
\stepcounter{legichapitre}%
\setcounter{legisection}{0}%
\setcounter{legisoussection}{0}%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2ex}%
\@afterindentfalse
\addcontentsline{toc}{subsection}{CHAPITRE \Roman{legichapitre} #1}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont{\thelegichapitre}
\par\nobreak%
\bfseries{#2}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
% Chapitre TOC
\newcommand*\l@legichapitre[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
% Section
% --------
\newcommand\legisection[2]{%
\stepcounter{legisection}%
\setcounter{legisoussection}{0}%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2ex}%
\@afterindentfalse
\addcontentsline{toc}{subsubsection}{SECTION \Roman{legisection} #1}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont{\thelegisection}
\par\nobreak%
\bfseries{#2}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
% Section TOC
\newcommand*\l@legisection[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
% Sous-Section
% ------------
\newcommand\legisoussection[2]{%
\stepcounter{legisoussection}%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2ex}%
\@afterindentfalse
\addcontentsline{toc}{paragraph}{SOUS-SECTION \Roman{legisoussection} #1}%
{\parindent \z@ \centering
\interlinepenalty \@M
\normalfont{\thelegisoussection}
\par\nobreak%
\bfseries{#2}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
% Sous-Section TOC
\newcommand*\l@legisoussection[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
\makeatother
% Article
% -------
\newcounter{legiarticleid}
\renewcommand{\thelegiarticleid}{\ifthenelse{\value{legiarticleid} = 1}{Article 1\textsuperscript{er}}{Art. \arabic{legiarticleid}}}
\makeatletter
\newcommand{\legiarticle}{%
\stepcounter{legiarticleid}%
\par%
\vskip 1ex
\@afterindentfalse
{\parindent \z@ \centering
\interlinepenalty \@M
\bfseries{\thelegiarticleid}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
\newcommand{\legimanualarticle}[1]{%
\par%
\vskip 1ex
\@afterindentfalse
{\parindent \z@ \centering
\interlinepenalty \@M
\bfseries{#1}
\markboth{}{}\par}%
\nobreak
\vskip 1ex
\@afterheading}
\makeatother
%\newcounter{legisection}
%\renewcommand{\thelegisection}{}
%\makeatletter
%\newcommand\legisection[4]{%
% \if@noskipsec \leavevmode \fi
% \par
% \addvspace{4ex}%
% \@afterindentfalse
% \addcontentsline{toc}{section}{#1 : #3}%
% {\parindent \z@ \centering
% \interlinepenalty \@M
% \normalfont\large{\textsc{#2}}
% \par\nobreak%
% \bfseries{#4}
% \markboth{}{}\par}%
% \nobreak
% \vskip 3ex
% \@afterheading}
%\newcommand*\l@legisection[2]{%
% \ifnum \c@tocdepth >\z@
% \addpenalty\@secpenalty
% \addvspace{1.0em \@plus\p@}%
% \setlength\@tempdima{1.5em}%
% \begingroup
% \parindent \z@ \rightskip \@pnumwidth
% \parfillskip -\@pnumwidth
% \leavevmode \bfseries
% \advance\leftskip\@tempdima
% \hskip -\leftskip
% #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
% \endgroup
% \fi}
%\makeatother
%%
%% End of file `PCFstd.cls'.

129
legi2pdf/script/db2pdf.py Executable file
View File

@ -0,0 +1,129 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Tabellio -- software suite for deliberative assemblies
# -- suite logicielle pour assemblées délibératives
# -- http://www.tabellio.org/
# Copyright (C) 2006 Parlement de la Communauté française de Belgique
# This file is part of Tabellio.
# Tabellio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Tabellio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import sys
import os
import string
import getopt
def printUsage():
print """
Usage: pdfGenerator.py [options]
Options:
--input-file or -i: name of the input .legi file
--output-pdf-file or -o: name of the output file (pdf) (optional)
--output-latex-file or -t: name of the output file (latex) (optional)
--help or -h: print this info page (optional)
--latex or -l: keep the latex file (optional)
--debug or -d: keep the temporary files (optional)
--brouillon or -b: draft stamp (optional)
--notoc: produce a pdf without table of content (defaut=with toc)
--annexe or -a: annexe definition
--parchemin or -p: style parchemin
--bqr or -q: style BQR
annexe definition = "filename|title|scale"
example:
pdfGenerator.py --input-file='test.legi' -a "annexe.pdf|Une annexe|O.9"
"""
if __name__ == '__main__':
file = os.path.abspath(sys.argv[0])
sys.path.append(os.path.join(os.path.dirname(file),"..","lib"))
sys.path.append(os.path.join(os.path.dirname(file),"..","..","..","pythonlib","trunk","pythonlib"))
from legi2pdf.pdfGenerator import convertLegi2Pdf
inputFile = None
outputPdfFile = None
outputLatexFile = None
keepLatex = 0
help = 0
debug = 0
draft = 0
toc = True
style= "normal"
annexes = []
optlist, args = getopt.getopt(sys.argv[1:],
'i:o:t:a:hldbpq', ['input-file=', 'output-pdf-file=', 'output-latex-file=',
'annexe=', 'help', 'latex', 'debug', 'brouillon', 'notoc', "parchemin", "bqr"])
for option,value in optlist:
if option == '-i' or option == '--input-file':
inputFile = value
elif option == '-o' or option == '--output-pdf-file':
outputPdfFile = value
elif option == '-t' or option == '--output-latex-file':
outputLatexFile = value
elif option == '-l' or option == '--latex':
keepLatex = 1
elif option == '-h' or option == '--help':
help = 1
elif option == '-d' or option == '--debug':
debug = 1
elif option == '-b' or option == '--brouillon':
draft = 1
elif option == '-p' or option == '--parchemin':
style = "parchment"
elif option == '-q' or option == '--bqr':
style = "bqr"
elif option == '--notoc':
toc = False
elif option == '-a' or option == '--annexe':
r = value.split('|')
if len(r) == 1:
annexes.append((r[0],"",100))
elif len(r) == 2:
annexes.append((r[0],r[1],100))
elif len(r) == 3:
scale = string.atoi(r[2])
annexes.append((r[0],r[1],scale))
else:
print "invalid option", option
printUsage()
sys.exit(-1)
else:
print "invalid option", option
if inputFile != None:
if outputPdfFile == None:
if inputFile.endswith('.legi'):
outputPdfFile = inputFile[:-5] + '.pdf'
else:
outputPdfFile = inputFile + '.pdf'
if outputLatexFile == None:
if outputPdfFile.endswith('.pdf'):
outputLatexFile = outputPdfFile[:-4] + '.tex'
else:
outputLatexFile = outputPdfFile + '.tex'
convertLegi2Pdf(inputFile, outputPdfFile, outputLatexFile, keepLatex, debug, annexes, draft, toc, style)
if help:
printUsage()
else:
printUsage()

23
legi2pdf/xsl/Makefile Normal file
View File

@ -0,0 +1,23 @@
all: contents.pdf
.PRECIOUS: .tex
%.pdf : %.tex
pdflatex $<
pdflatex $<
%.tex : 2_%.xml
xsltproc -o $@ post_proc.xsl $<
2_%.xml : 1_%.xml
xsltproc -o $@ main.xsl $<
1_%.xml : %.xml
xsltproc -o $@ pre_proc.xsl $<
clean:
rm -rf *.log *.out *.brf *.aux *.glo *.idx *.toc
clean_all: clean
rm -rf *.pdf

175
legi2pdf/xsl/README Normal file
View File

@ -0,0 +1,175 @@
Objectifs du test:
------------------
Valider la transformation d'un document .LEGI en .PDF pour des éléments suivants:
o Préface
o Numérotation des sections
Issues:
-------
1) En utilisant Word, lorsque que l'on crée une préface sans titre pour une 'partie' de document, le fichier docbook généré définit un contenu normal et non une préface.
Commentaires:
-------------
#######################################################################
1) Pour modifier le début du fichier latex en fonction de article ou book, il faut surcharger la variable: latex.book.preamblestart (la valeur par défaut se trouve dans le fichier 'preamble.mod.xsl')
Cette règle semble incorrect: \ifx\pdfoutput\undefined ... $latex.documentclass.pdftex
<xsl:param name="latex.book.preamblestart">
<xsl:text>% ------------------------------------------------------------ &#10;</xsl:text>
<xsl:text>% Autogenerated LaTeX file for books &#10;</xsl:text>
<xsl:text>% ------------------------------------------------------------ &#10;</xsl:text>
<xsl:text>\ifx\pdfoutput\undefined&#10;</xsl:text>
<xsl:text>\documentclass[</xsl:text>
<xsl:value-of select='$latex.documentclass.common' />
<xsl:text>,</xsl:text>
<xsl:value-of select='$latex.documentclass.book' />
<xsl:text>,</xsl:text>
<xsl:value-of select='$latex.documentclass.pdftex' />
***************************
<xsl:text>]{</xsl:text>
<xsl:choose>
<xsl:when test="$latex.documentclass!=''"><xsl:value-of select="$latex.documentclass" /></xsl:when>
<xsl:otherwise><xsl:text>report</xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\else&#10;</xsl:text>
<xsl:text>\documentclass[pdftex,</xsl:text>
<xsl:value-of select='$latex.documentclass.common' />
<xsl:text>,</xsl:text>
<xsl:value-of select='$latex.documentclass.book' />
<xsl:text>,</xsl:text>
<xsl:value-of select='$latex.documentclass.dvips' />
***************************
<xsl:text>]{</xsl:text>
<xsl:choose>
<xsl:when test="$latex.documentclass!=''"><xsl:value-of select="$latex.documentclass" /></xsl:when>
<xsl:otherwise><xsl:text>report</xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\fi&#10;</xsl:text>
</xsl:param>
#######################################################################
2) Définition d'une règle pour supprimer les metadata's
Pour l'instant la règle est simpliste:
<xsl:template match="metadata" />
Il faudra checker si il ne faut pas récupérer de l'info dans les metadatas ...
#######################################################################
3) Header / Footer
Définition de la variable "latex.book.preamble.post" afin de surcharger la définition par défaut se trouvant dans le fichier 'preamble.mod.xsl'
Le contenu de cette variable est inséré dans le fichier généré après le contenu des autres variables et avant le début du document. (cf. generate.latex.book.preamble)
Problèmes:
o utilisation de truncate provoque un mauvais allignement.
#######################################################################
4) Titre
Insertion d'un document titre.tex que l'on peut générer séparément
Info ????
#######################################################################
5) Libellés de chapitre ...
Redefinition des variables de LaTeX utilisées pour créer les tables des matières, figures, ...
Attention comme on utilise "babel" un simple \renewcommand{\name}{new name} n'est pas suffisant, il faut par exemple utiliserla syntaxe suivante:
\addto\captionsfrench{\renewcommand{\contentsname}%
{\centerline{TABLE DES MATIERES}}}
A mettre dans latex.book.preamble.post
\renewcommand*{\thesection}{\Roman{section}.}
\renewcommand*{\thesubsection}{\textit{\alph{subsection})}}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}\textsuperscript{o}}
#######################################################################
6) Préface / Titre
Au lieu de générer la command latex /chapter*{...} il faut générer la command /section*{}
En effet chapter n'existe pas dans la style article.
Vu que le latex généré pour le tag preface se trouve dans la table de mapping, il est nécessaire de définir une table locale ne définissant que les règles spécifiques (fichier: local.mapping.xml) + définition de la variable:
<xsl:variable name="latex.mapping.xml" select="document('local.mapping.xml')"/>
#######################################################################
7) Colonnes
L'espace entre les 2 colonnes peut être modifié avec la commande:
\setlength{\columnsep}{30pt}
A mettre dans latex.book.preamble.post
#######################################################################
8) Listes
Pour changer le symbole associé à une liste on peut soit modifier le latex généré pour avoir \item[---] soit modifier globalement avec renewcommand et les paramètres labelitemi ii iii iv
Attention les \renewcommand doivent se mettre après le début du document (c-à-d: tag \begin{document})
Exemple:
\renewcommand{\labelitemi}{---}
\renewcommand{\labelitemii}{--}
\renewcommand{\labelitemiii}{-}
\renewcommand{\labelitemiv}{$\bullet$}
Idem pour les énumérations:
\renewcommand{\labelenumi}{( \roman{enumi} )}
\renewcommand{\labelenumii}{\arabic{enumii}}
enumi ou enumii est le compteur interne de latex pour les énumérations de niveau 1 et 2.
Comment insérer ces commandes juste après le begin{document} ?
redéfinition du template:
<xsl:param name="latex.book.begindocument">
<xsl:text>\begin{document}
...
</xsl:text>
</xsl:param>
Remarque:
Les listes dans une note de bas de page sont correctement gérées par Db2Latex; le problème est lié à la création du document legi par Word.
#######################################################################
9) Euro
Utilisation du package eurosym et de la commande \euro
\usepackage{eurosym}
... \euro
Création d'une règle pour filtrer le caractère unicode 0x20AC en \euro
lors d'un post processing -> si on rélaise cette transformation en pre-processing le \ est remplacé par \backslash
#######################################################################
10) emphasis
role="bold" OK
role="italic" OK
#######################################################################
11) Note
Définition de la variable latex.admonition.path pour que db2latex puisse trouver les fichiers images.
<xsl:variable name="latex.admonition.path">/home/rfl/db2latex/xsl/figures</xsl:variable>
Résulat: too much
#######################################################################
11) Literallayout
Le literallyout est traduit en LaTeX par \begin{verbatim} ... \end{verbatim}
Problème: Ne tient pas compte de la largeur de la colonne
Définition d'un nouvel environment 'literallayout' qui change la font en font type machine à écrire.
Re-définition de la règle qui match "literallayout"
<xsl:template match="literallayout">
<xsl:text>&#10;\begin{literallayout}&#10;</xsl:text>
<xsl:apply-templates mode="latex.verbatim"/>
<xsl:text>&#10;\end{literallayout}&#10;</xsl:text>
</xsl:template>
#######################################################################
12) Speech
Création d'une règle pour la transformation:

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:param name="annex-id"/>
<xsl:param name="annex-title"/>
<!-- FileName: annex_pre_proc.xsl -->
<!--
Purpose: Preprocessing rules to transform the chapter / sect(xxx)
to section.
-->
<xsl:template match="/">
<xsl:element name="appendix">
<xsl:attribute name="type">legi</xsl:attribute>
<xsl:element name="title">
<xsl:value-of select="$annex-title"/>
</xsl:element>
<xsl:apply-templates select="book/*"/>
</xsl:element>
</xsl:template>
<xsl:template match="metadata">
</xsl:template>
<xsl:template match="imagedata/@fileref">
<xsl:attribute name="fileref">
<xsl:value-of select="concat($annex-id, . )"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="para">
<xsl:choose>
<xsl:when test="@role='legistic_article'">
<xsl:element name="legistic_article">
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:when test="@role='legistic_manualarticle'">
<xsl:element name="legistic_manualarticle">
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="para">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="chapter|sect1|sect2|sect3|sect4|sect5|sect6">
<xsl:element name="section">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

126
legi2pdf/xsl/appendix.xsl Normal file
View File

@ -0,0 +1,126 @@
<?xml version='1.0' encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: appendix.xsl -->
<xsl:param name="parchemin"/>
<!-- appendix template -->
<xsl:template match="appendix">
<xsl:if test="not (preceding-sibling::appendix)">
<xsl:text>&#10;</xsl:text>
<xsl:text>%\balance&#10;</xsl:text>
<xsl:text>% ------------------------------------------------------------- &#10;</xsl:text>
<xsl:text>% Appendices start here&#10;</xsl:text>
<xsl:text>% -------------------------------------------------------------&#10;</xsl:text>
</xsl:if>
<xsl:variable name="object" select="."/>
<xsl:variable name="keyword" select="local-name($object)"/>
<xsl:variable name="id">
<xsl:call-template name="generate.label.id">
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="@type='legi'">
<xsl:text>%\balance&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>% -------------------------------------------------------------&#10;</xsl:text>
<xsl:text>% appendix: </xsl:text>
<xsl:value-of select="title"/>
<xsl:text>&#10;</xsl:text>
<xsl:text>% -------------------------------------------------------------&#10;</xsl:text>
<xsl:if test="title!=''">
<xsl:text>\twocolumn[\pcfannexe{</xsl:text>
<xsl:value-of select="title"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
<xsl:text>]&#10;</xsl:text>
</xsl:if>
<xsl:call-template name="content-templates"/>
</xsl:when>
<xsl:when test="@type='pdf'">
<xsl:text>%\balance&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>% -------------------------------------------------------------&#10;</xsl:text>
<xsl:text>% appendix: </xsl:text>
<xsl:value-of select="title"/>
<xsl:text>&#10;</xsl:text>
<xsl:text>% -------------------------------------------------------------&#10;</xsl:text>
<xsl:choose>
<xsl:when test="$parchemin">
<xsl:if test="title!=''">
<xsl:text>\twocolumn[\pcfannexe{</xsl:text>
<xsl:value-of select="title"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
<xsl:text>]&#10;</xsl:text>
</xsl:if>
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\includepdf[pages={-},offset=15.5mm -15.5mm,scale=</xsl:text>
<xsl:value-of select="pdf-annex/@scale"/>
<xsl:text>]{</xsl:text>
<xsl:value-of select="pdf-annex/@pdf-file"/>
<xsl:text>}&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="title!=''">
<xsl:text>\twocolumn[\pcfannexe{</xsl:text>
<xsl:value-of select="title"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
<xsl:text>]&#10;</xsl:text>
</xsl:if>
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\includepdf[pages={-},pagecommand={\pagestyle{fancy}},scale=</xsl:text>
<xsl:value-of select="pdf-annex/@scale"/>
<xsl:text>]{</xsl:text>
<xsl:value-of select="pdf-annex/@pdf-file"/>
<xsl:text>}&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1 @@
Placez ici le contenu du répertoire "xsl" de db2latex

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: db2latex_custom.xsl -->
<!--
Purpose: re-definition of the db2latex variables.
-->
<xsl:param name="with-draft-tag"/>
<xsl:param name="parchemin"/>
<!-- Customization of Db2Latex product -->
<xsl:variable name="latex.mapping.xml" select="document('local.mapping.xml')"/>
<xsl:variable name="latex.inputenc">utf8</xsl:variable>
<xsl:variable name="latex.document.font">sabon</xsl:variable>
<xsl:variable name="admon.graphics.path">/home/rfl/db2latex/xsl/figures</xsl:variable>
<xsl:variable name="latex.documentclass.book">
<xsl:choose>
<xsl:when test="$parchemin">notitlepage,twocolumn,openany,10pt</xsl:when>
<xsl:otherwise>a4paper,twocolumn,notitlepage,openany,twoside,10pt</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="latex.documentclass">PCFstd</xsl:variable>
<xsl:variable name="latex.titlepage.file"></xsl:variable>
<xsl:variable name="latex.maketitle"></xsl:variable>
<xsl:variable name="latex.book.preamble.pre"></xsl:variable>
<xsl:param name="latex.hyperref.param.common">bookmarksnumbered,colorlinks=false,backref, bookmarks, breaklinks, linktocpage</xsl:param>
<xsl:param name="latex.book.begindocument">
<xsl:text>\begin{document}&#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:text>% Begin of document&#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:if test="$parchemin">
<xsl:text>\setlength{\pdfpagewidth}{241mm}&#10;</xsl:text>
<xsl:text>\setlength{\pdfpageheight}{317mm}&#10;</xsl:text>
</xsl:if>
<xsl:text>\renewcommand{\labelitemi}{$\bullet$}&#10;</xsl:text>
<xsl:text>\renewcommand{\labelitemii}{$\bullet$}&#10;</xsl:text>
<xsl:text>\renewcommand{\labelitemiii}{$\bullet$}&#10;</xsl:text>
<xsl:text>\renewcommand{\labelitemiv}{$\bullet$}&#10;</xsl:text>
<xsl:text>\renewcommand{\labelenumi}{( \roman{enumi} )}&#10;</xsl:text>
<xsl:text>\renewcommand{\labelenumii}{\arabic{enumii}}&#10;</xsl:text>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:text>\setcounter{secnumdepth}{5}&#10;</xsl:text>
<xsl:text>\setcounter{tocdepth}{4}&#10;</xsl:text>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:if test="$with-draft-tag">
<xsl:text>&#10;</xsl:text>
<xsl:text>\AddToShipoutPicture{% watermark&#10;</xsl:text>
<xsl:text>\AtTextCenter{\makebox[0pt]{\scalebox{6}{%&#10;</xsl:text>
<xsl:text>\rotatebox[origin=c]{45}%&#10;</xsl:text>
<xsl:text>{\color[gray]{.9}VERSION PROVISOIRE}}}}}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:if>
</xsl:param>
<xsl:template name="latex.float.preamble">
</xsl:template>
<xsl:template name="latex.hyperref.preamble">
</xsl:template>
<xsl:param name="latex.pdf.preamble">
<xsl:text>\usepackage{ifthen}&#10;</xsl:text>
<xsl:text>\usepackage[T1]{fontenc}&#10;</xsl:text>
<xsl:text>\usepackage{ucs}&#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:text>% Check for PDFLaTeX/LaTeX &#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:text>\newif\ifpdf&#10;</xsl:text>
<xsl:text>\ifx\pdfoutput\undefined&#10;</xsl:text>
<xsl:text>\pdffalse % we are not running PDFLaTeX&#10;</xsl:text>
<xsl:text>\else&#10;</xsl:text>
<xsl:text>\pdfoutput=1 % we are running PDFLaTeX&#10;</xsl:text>
<xsl:text>\pdftrue&#10;</xsl:text>
<xsl:text>\fi&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>\usepackage[pdftex,&#10;</xsl:text>
<xsl:text> colorlinks,&#10;</xsl:text>
<xsl:text> urlcolor=rltblack,&#10;</xsl:text>
<xsl:text> filecolor=rltblack,&#10;</xsl:text>
<xsl:text> linkcolor=rltblack,&#10;</xsl:text>
<xsl:text> pdftitle={My Document},&#10;</xsl:text>
<xsl:text> pdfauthor={Tabellio},&#10;</xsl:text>
<xsl:text> pdfproducer={pdfLaTeX},&#10;</xsl:text>
<xsl:text> bookmarksnumbered,&#10;</xsl:text>
<xsl:text> backref, &#10;</xsl:text>
<xsl:text> bookmarks=false, &#10;</xsl:text>
<xsl:text> breaklinks, &#10;</xsl:text>
<xsl:text> linktocpage,&#10;</xsl:text>
<xsl:text> pdfstartview=FitH]{hyperref}&#10;</xsl:text>
<xsl:if test="$bqr">
<xsl:text>\usepackage{multicol}&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<xsl:if test="$with-draft-tag">
<xsl:text>&#10;</xsl:text>
<xsl:text>\usepackage{eso-pic}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:if>
</xsl:param>
<xsl:variable name="latex.book.preamble.post">
<xsl:text>&#10;</xsl:text>
<xsl:text>\makeatletter&#10;</xsl:text>
<xsl:text>\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{3.3em}}&#10;</xsl:text>
<xsl:text>\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{4.3em}} &#10;</xsl:text>
<xsl:text>\renewcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{5em}&#10;</xsl:text>}
<xsl:text>\renewcommand*\l@subparagraph{\@dottedtocline{5}{10em}{5em}} &#10;</xsl:text>
<xsl:text>\makeatother&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>\setlength{\hoffset}{-0.46cm}&#10;</xsl:text>
<xsl:text>\setlength{\voffset}{-0.56cm}&#10;</xsl:text>
<xsl:text>\setlength{\textwidth}{15.9cm}&#10;</xsl:text>
<xsl:text>\setlength{\textheight}{24.3cm} &#10;</xsl:text>
<xsl:text>\setlength{\oddsidemargin}{0.55cm}&#10;</xsl:text>
<xsl:text>\setlength{\evensidemargin}{0.55cm}&#10;</xsl:text>
<xsl:text>\setlength{\topmargin}{0.1cm}&#10;</xsl:text>
<xsl:text>\setlength{\headheight}{0.4cm}&#10;</xsl:text>
<xsl:text>\setlength{\headsep}{0.6cm}&#10;</xsl:text>
<xsl:text>\setlength{\marginparwidth}{0cm}&#10;</xsl:text>
<xsl:text>\setlength{\marginparsep}{0cm}&#10;</xsl:text>
<xsl:text>\setlength{\columnsep}{0.8cm} &#10;</xsl:text>
<xsl:if test="$parchemin">
<xsl:text>\setlength{\textheight}{26.5cm} &#10;</xsl:text>
<xsl:text>\setlength{\oddsidemargin}{1.75cm}&#10;</xsl:text>
<xsl:text>\setlength{\evensidemargin}{1.75cm}&#10;</xsl:text>
</xsl:if>
<xsl:if test="$bqr">
<xsl:text>\renewcommand{\thesubsection}{}&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>% --------------------------------------&#10;</xsl:text>
<xsl:text>% Definition des headers / footers&#10;</xsl:text>
<xsl:text>% --------------------------------------&#10;</xsl:text>
<xsl:text>\newenvironment{literallayout}&#10;</xsl:text>
<xsl:text>{\fontfamily{psb}\selectfont}{}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>\renewcommand{\headrulewidth}{0pt}&#10;</xsl:text>
<xsl:text>\renewcommand{\footrulewidth}{0pt}&#10;</xsl:text>
<xsl:text>\fancyhead[EL,OR]{\footnotesize{</xsl:text>
<xsl:value-of select="$pdfgen.document.id"/>
<xsl:text>}}&#10;</xsl:text>
<xsl:text>\fancyhead[C]{\footnotesize{( \thepage{} )}}&#10;</xsl:text>
<xsl:text>\fancyhead[ER,OL]{}&#10;</xsl:text>
<xsl:text>\fancyfoot{}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:variable>
<xsl:param name="latex.book.end">
<xsl:if test="$parchemin">
<xsl:text>\end{changemargin}&#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:text>% Last part: Parchemin&#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>\newpage&#10;</xsl:text>
<xsl:text>\begin{list}{}{&#10;</xsl:text>
<xsl:text>\setlength{\parsep}{0.2cm plus 1pt}&#10;</xsl:text>
<xsl:text>\addtolength{\leftmargin}{3cm}&#10;</xsl:text>
<xsl:text>\addtolength{\rightmargin}{3cm}&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\item&#10;</xsl:text>
<xsl:text>\center{\large{ADOPT\'{E} PAR}} \\&#10;</xsl:text>
<xsl:text>\center{\large{LE PARLEMENT DE LA COMMUNAUT\'{E}}} \\&#10;</xsl:text>
<xsl:text>\center{\large{FRAN\c{C}AISE}} \\[1.5cm]&#10;</xsl:text>
<xsl:if test="/book/metadata/property[@name='date']">
<xsl:text>\begin{flushleft}Bruxelles, le </xsl:text>
<xsl:value-of select="/book/metadata/property[@name='date']"/>
<xsl:text>. \\[1.5cm] \end{flushleft}&#10;</xsl:text>
</xsl:if>
<xsl:text>\center{\textit{Le Pr\'{e}sident}} \\&#10;</xsl:text>
<xsl:text>\center{\textit{du Parlement de la Communaut\'{e} fran\c{c}aise,}} \\[5.5cm]&#10;</xsl:text>
<xsl:text>\center{\textit{Les Secr\'{e}taires,}} \\[5.5cm]&#10;</xsl:text>
<xsl:text>\center{\textit{Le Greffier,}} \\&#10;</xsl:text>
<xsl:text>\newpage&#10;</xsl:text>
<xsl:text>\begin{flushleft}Promulguons le pr\'{e}sent d\'{e}cret, ordonnons qu'il soit publi\'{e} au \textit{Moniteur belge}. \\[1.5cm]&#10;</xsl:text>
<xsl:text>\end{flushleft}&#10;</xsl:text>
<xsl:text>\begin{flushleft}Donn\'{e} \`a\end{flushleft}&#10;</xsl:text>
<xsl:text>\end{list}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
<xsl:text>% End of document&#10;</xsl:text>
<xsl:text>% --------------------------------------------&#10;</xsl:text>
</xsl:param>
</xsl:stylesheet>

642
legi2pdf/xsl/first_page.xsl Normal file
View File

@ -0,0 +1,642 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: first_page.xsl -->
<!--
Purpose: Templates to define first page of a document taking
into account the metadata.
-->
<xsl:param name="with-toc"/>
<xsl:param name="parchemin"/>
<xsl:param name="bqr"/>
<xsl:variable name="pdfgen.metadata.no" select="/book/metadata/property[@name='no']"/>
<xsl:variable name="pdfgen.metadata.sess" select="/book/metadata/property[@name='sess']"/>
<xsl:variable name="pdfgen.metadata.nodoc" select="/book/metadata/property[@name='nodoc']"/>
<xsl:variable name="pdfgen.metadata.docsess" select="/book/metadata/property[@name='docsess']"/>
<xsl:variable name="pdfgen.metadata.anx" select="/book/metadata/property[@name='anx']"/>
<xsl:variable name="pdfgen.metadata.date" select="/book/metadata/property[@name='date']"/>
<xsl:variable name="pdfgen.metadata.typedocid" select="/book/metadata/property[@name='typedocid']"/>
<xsl:variable name="pdfgen.metadata.session" select="/book/metadata/property[@name='docsess']"/>
<xsl:variable name="pdfgen.metadata.intitdos">
<xsl:call-template name="escape-percent">
<xsl:with-param name="string">
<xsl:call-template name="footnote-syntax-replace">
<xsl:with-param name="string" select="/book/metadata/property[@name='intitdos']"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.intitdoc">
<xsl:call-template name="escape-percent">
<xsl:with-param name="string">
<xsl:call-template name="footnote-syntax-replace">
<xsl:with-param name="string" select="/book/metadata/property[@name='intitdoc']"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.typedos">
<xsl:call-template name="escape-percent">
<xsl:with-param name="string">
<xsl:call-template name="footnote-syntax-replace-protect-from-uppercase">
<xsl:with-param name="string" select="/book/metadata/property[@name='typedos']"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.typedoc">
<xsl:call-template name="escape-percent">
<xsl:with-param name="string">
<xsl:call-template name="footnote-syntax-replace-protect-from-uppercase">
<xsl:with-param name="string" select="/book/metadata/property[@name='typedoc']"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.commentaires">
<xsl:call-template name="escape-percent">
<xsl:with-param name="string">
<xsl:call-template name="footnote-syntax-replace">
<xsl:with-param name="string" select="/book/metadata/property[@name='commentaires']"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.tailletitres" select="/book/metadata/property[@name='tailletitres']"/>
<xsl:variable name="pdfgen.metadata.remplace" select="/book/metadata/property[@name='remplace']"/>
<xsl:variable name="pdfgen.metadata.comname" select="/book/metadata/property[@name='comname']"/>
<xsl:variable name="pdfgen.document.intitdoc">
<xsl:choose>
<xsl:when test="starts-with($pdfgen.metadata.intitdoc,'spécial')">
<xsl:value-of select="substring-after($pdfgen.metadata.intitdoc,'spécial')"/>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'AMENDCOM'">
<xsl:text>\uppercase{déposé(s) en commission}</xsl:text>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'AMENDSCE'">
<xsl:text>\uppercase{déposé(s) en séance}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$pdfgen.metadata.intitdoc"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pdfgen.document.typedoc">
<xsl:choose>
<xsl:when test="starts-with($pdfgen.metadata.intitdoc,'spécial')">
<xsl:value-of select="$pdfgen.metadata.typedoc"/>
<xsl:text> spécial</xsl:text>
</xsl:when>
<xsl:when test="starts-with($pdfgen.metadata.typedocid, 'AMEND')">
<xsl:text>Amendement(s)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$pdfgen.metadata.typedoc"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pdfgen.document.session">
<xsl:choose>
<xsl:when test="starts-with($pdfgen.metadata.session,'SE')">
<xsl:text>Session extraordinaire de </xsl:text>
<xsl:value-of select="substring-after($pdfgen.metadata.session,'SE')"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Session </xsl:text>
<xsl:value-of select="$pdfgen.metadata.session"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.no.prefix">
<xsl:choose>
<xsl:when test="$pdfgen.metadata.typedocid = 'CRI'">
<xsl:text>CRI N\textsuperscript{o}</xsl:text>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'CRICOM'">
<xsl:text>CRIc N\textsuperscript{o}</xsl:text>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'BQR'">
<xsl:text>N\textsuperscript{o}</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pdfgen.metadata.depose_par">
<xsl:choose>
<xsl:when test="$pdfgen.metadata.typedocid = 'PPD'">
<xsl:text>déposée par </xsl:text>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'DG-PPMS'">
<xsl:text>déposée par </xsl:text>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'PPMR'">
<xsl:text>déposée par </xsl:text>
</xsl:when>
<xsl:when test="$pdfgen.metadata.typedocid = 'DG-PPR'">
<xsl:text>déposée par </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>par </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pdfgen.document.id">
<xsl:text>\textbf{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.no.prefix"/>
<xsl:value-of select="$pdfgen.metadata.no"/>
<xsl:text>} (</xsl:text>
<xsl:value-of select="$pdfgen.metadata.sess"/>
<xsl:text>)</xsl:text>
<xsl:if test="/book/metadata/property[@name='nodoc']">
<xsl:text> --- N\textsuperscript{o} </xsl:text>
<xsl:value-of select="$pdfgen.metadata.nodoc"/>
</xsl:if>
<xsl:if test="/book/metadata/property[@name='anx']">
<xsl:text> (Annexe </xsl:text>
<xsl:value-of select="$pdfgen.metadata.anx"/>
<xsl:text>) </xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="pdfgen.document.title.id">
<xsl:text>\textbf{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.no.prefix"/>
<xsl:value-of select="$pdfgen.metadata.no"/>
<xsl:text>} (</xsl:text>
<xsl:value-of select="$pdfgen.metadata.sess"/>
<xsl:text>)</xsl:text>
<xsl:if test="/book/metadata/property[@name='nodoc']">
<xsl:text> --- N\textsuperscript{o} </xsl:text>
<xsl:value-of select="$pdfgen.metadata.nodoc"/>
</xsl:if>
<xsl:if test="/book/metadata/property[@name='anx']">
<xsl:text> (Annexe </xsl:text>
<xsl:value-of select="$pdfgen.metadata.anx"/>
<xsl:text>) </xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="pdfgen.document.tailletitres">
<xsl:choose>
<xsl:when test="not($pdfgen.metadata.tailletitres) or ( $pdfgen.metadata.tailletitres = '' )">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$pdfgen.metadata.tailletitres"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="metadata">
<xsl:choose>
<xsl:when test="$parchemin">
<xsl:call-template name="first-page-parchemin">
</xsl:call-template>
</xsl:when>
<xsl:when test="$bqr">
<xsl:call-template name="first-page-bqr">
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="first-page-normal">
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="first-page-parchemin">
<!-- First part of the page -->
<xsl:text>\pagestyle{empty}&#10;</xsl:text>
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\vspace*{-1.5cm}&#10;</xsl:text>
<!-- Main title with the session reference -->
<xsl:text>\begin{changemargin}{0cm}{0cm}&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\begin{minipage}[b][10cm][c]{15cm}&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textbf{{Le Parlement}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textbf{{de la Communaut\'{e} fran\c{c}aise}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textbf{{a adopt\'{e}}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textbf{{et Nous, Gouvernement,}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textbf{{sanctionnons ce qui suit:}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>\end{minipage}&#10;</xsl:text>
<xsl:text>\end{changemargin}&#10;</xsl:text>
<xsl:text>\normalfont&#10;</xsl:text>
<!-- HACK to prevent bad aligment in changemargin environment -->
<xsl:text>&#10;</xsl:text>
<xsl:text>\renewenvironment{changemargin}[2]{\begin{list}{}{&#10;</xsl:text>
<xsl:text>\setlength{\topsep}{0pt}%&#10;</xsl:text>
<xsl:text>\setlength{\leftmargin}{0pt}%&#10;</xsl:text>
<xsl:text>\setlength{\rightmargin}{0pt}%&#10;</xsl:text>
<xsl:text>\setlength{\listparindent}{\parindent}%&#10;</xsl:text>
<xsl:text>\setlength{\itemindent}{0pt}%&#10;</xsl:text> <!-- HACK IS HERE -->
<xsl:text>\setlength{\parsep}{0.2cm plus 1pt}%&#10;</xsl:text>
<xsl:text>\addtolength{\leftmargin}{#1}%&#10;</xsl:text>
<xsl:text>\addtolength{\rightmargin}{#2}%&#10;</xsl:text>
<xsl:text>}\item }{\end{list}}%&#10;</xsl:text>
<xsl:text>\begin{changemargin}{4.25cm}{4.25cm}&#10;</xsl:text>
</xsl:template>
<xsl:template name="first-page-bqr">
<!-- First part of the page -->
<xsl:text>\thispagestyle{empty}&#10;</xsl:text>
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\vspace*{-1.5cm}&#10;</xsl:text>
<!-- Header part definition -->
<xsl:text>\begin{changemargin}{-0.9cm}{-0.6cm}&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\noindent\large{</xsl:text>
<xsl:value-of select="$pdfgen.document.title.id"/>
<xsl:text>}</xsl:text>
<xsl:text>\hfill\large{</xsl:text>
<xsl:value-of select="$pdfgen.document.title.id"/>
<xsl:text>}</xsl:text>
<xsl:text>\\[-0.3cm]&#10;</xsl:text>
<xsl:text>\rule{17.5cm}{0.04cm}&#10;</xsl:text>
<!-- Main title with the session reference -->
<xsl:text>\normalfont&#10;</xsl:text>
<xsl:text>\begin{minipage}[b][7.6cm][c]{17.5cm}&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\textbf{&#10;</xsl:text>
<xsl:text>\Huge\textmd{{PARLEMENT}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\LARGE\textmd{{DE LA}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textmd{{COMMUNAUT\'{E} FRAN\c{C}AISE}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\Large\textmd{{</xsl:text>
<xsl:value-of select="$pdfgen.document.session"/>
<xsl:text>}}}&#10;</xsl:text>
<xsl:text>\normalfont&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>\end{minipage}&#10;</xsl:text>
<xsl:text>\begin{minipage}[b][0.8cm][s]{17.5cm}&#10;</xsl:text>
<xsl:text>\rule{17.5cm}{0.04cm}&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\center\uppercase{{</xsl:text>
<xsl:value-of select="property[@name='date']"/>
<xsl:text>}}\\[-0.3cm]&#10;</xsl:text>
<xsl:text>\normalfont&#10;</xsl:text>
<xsl:text>\rule{17.5cm}{0.04cm}&#10;</xsl:text>
<xsl:text>\end{minipage}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<!-- First titleMain title with the session reference -->
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\begin{center}\parbox[b][][c]{15cm}{&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\LARGE\uppercase{{BULLETIN DES QUESTIONS ET REPONSES}}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>}\end{center}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<!-- Bottom of the page -->
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\end{changemargin}&#10;</xsl:text>
<xsl:if test="$with-toc">
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\tableofcontents&#10;</xsl:text>
<xsl:if test="(//table/title) and not($bqr)">
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\listoftables&#10;</xsl:text>
</xsl:if>
<xsl:if test="(//mediaobject/caption) and not($bqr)">
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\listoffigures&#10;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:text>\onecolumn&#10;</xsl:text>
</xsl:template>
<xsl:template name="first-page-normal">
<!-- First part of the page -->
<xsl:text>\thispagestyle{empty}&#10;</xsl:text>
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\vspace*{-1.5cm}&#10;</xsl:text>
<!-- Header part definition -->
<xsl:text>\begin{changemargin}{-0.9cm}{-0.6cm}&#10;</xsl:text>
<xsl:if test="$pdfgen.metadata.remplace = 'true'">
<xsl:text>\vspace*{-12pt}&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:text>\noindent{\textmd{\textbf{\uppercase{Ce document remplace et annule le document distribué précédemment}}}}\\&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
</xsl:if>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\noindent\large{</xsl:text>
<xsl:value-of select="$pdfgen.document.title.id"/>
<xsl:text>}</xsl:text>
<xsl:text>\hfill\large{</xsl:text>
<xsl:value-of select="$pdfgen.document.title.id"/>
<xsl:text>}</xsl:text>
<xsl:text>\\[-0.3cm]&#10;</xsl:text>
<xsl:text>\rule{17.5cm}{0.04cm}&#10;</xsl:text>
<!-- Main title with the session reference -->
<xsl:text>\normalfont&#10;</xsl:text>
<xsl:choose>
<xsl:when test="$pdfgen.metadata.typedocid = 'CRICOM'">
<xsl:text>\begin{minipage}[b][10.1cm][c]{17.5cm}&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\begin{minipage}[b][7.6cm][c]{17.5cm}&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\textbf{&#10;</xsl:text>
<xsl:if test="$pdfgen.metadata.typedocid = 'CRICOM'">
<xsl:if test="$pdfgen.metadata.comname">
<xsl:text>\huge\textmd{{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.comname"/>
<xsl:text>}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:text>\Huge\textmd{{PARLEMENT}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\LARGE\textmd{{DE LA}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\Huge\textmd{{COMMUNAUT\'{E} FRAN\c{C}AISE}} \\&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\Large\textmd{{</xsl:text>
<xsl:value-of select="$pdfgen.document.session"/>
<xsl:text>}}}&#10;</xsl:text>
<xsl:text>\normalfont&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>\end{minipage}&#10;</xsl:text>
<xsl:text>\begin{minipage}[b][0.8cm][s]{17.5cm}&#10;</xsl:text>
<xsl:text>\rule{17.5cm}{0.04cm}&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont&#10;</xsl:text>
<xsl:text>\center\uppercase{{</xsl:text>
<xsl:value-of select="property[@name='date']"/>
<xsl:text>}}\\[-0.3cm]&#10;</xsl:text>
<xsl:text>\normalfont&#10;</xsl:text>
<xsl:text>\rule{17.5cm}{0.04cm}&#10;</xsl:text>
<xsl:text>\end{minipage}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<!-- First titleMain title with the session reference -->
<xsl:if test="property[@name='typedos'] != '' or property[@name='intitdos'] != ''">
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\relsize{</xsl:text>
<xsl:value-of select="$pdfgen.document.tailletitres"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\begin{center}\parbox[b][][c]{15cm}{&#10;</xsl:text>
<xsl:text>\begin{center}\renewcommand{\baselinestretch}{1.4}&#10;</xsl:text>
<xsl:if test="property[@name='typedos'] != ''">
<!-- 2) Title part -->
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont\relsize{2}\uppercase{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.typedos"/>
<xsl:if test="not(property[@name='intitdos'] != '') and property[@name='docrefs'] != ''">
<xsl:text>\footnote{</xsl:text>
<xsl:value-of select="property[@name='docrefs']"/>
<xsl:text>}&#10;</xsl:text>
</xsl:if>
<xsl:text>} \\[0.5cm]&#10;</xsl:text>
</xsl:if>
<xsl:if test="property[@name='intitdos'] != ''">
<!-- 2) Sub-title part -->
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont\relsize{-2}\textsc{{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.intitdos"/>
<xsl:if test="property[@name='docrefs'] != ''">
<xsl:text>\footnote{</xsl:text>
<xsl:value-of select="property[@name='docrefs']"/>
<xsl:text>}&#10;</xsl:text>
</xsl:if>
<xsl:text>}}\\&#10;</xsl:text>
</xsl:if>
<xsl:text>\rule{1.2cm}{1pt}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>}\end{center}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
</xsl:if>
<xsl:if test="property[@name='typedoc'] != '' or property[@name='intitdoc'] != ''">
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\begin{center}\parbox[b][][c]{15cm}{&#10;</xsl:text>
<xsl:text>\begin{center}\renewcommand{\baselinestretch}{1.4}&#10;</xsl:text>
<xsl:if test="property[@name='typedoc'] != ''">
<!-- 2) Title part -->
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont\relsize{2}\uppercase{</xsl:text>
<xsl:value-of select="$pdfgen.document.typedoc"/>
<xsl:if test="not (property[@name='typedos'] != '') and
not (property[@name='intitdos'] != '')
and not(property[@name='intitdoc'] != '')
and property[@name='docrefs'] != ''">
<xsl:text>\footnote{</xsl:text>
<xsl:value-of select="property[@name='docrefs']"/>
<xsl:text>}&#10;</xsl:text>
</xsl:if>
<xsl:text>} \\[0.5cm]&#10;</xsl:text>
</xsl:if>
<xsl:if test="$pdfgen.document.intitdoc != ''">
<!-- 2) Sub-title part -->
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont\relsize{-2}\textsc{{</xsl:text>
<xsl:value-of select="$pdfgen.document.intitdoc"/>
<xsl:if test="not (property[@name='typedos'] != '') and
not (property[@name='intitdos'] != '') and
property[@name='docrefs'] != ''">
<xsl:text>\footnote{</xsl:text>
<xsl:value-of select="property[@name='docrefs']"/>
<xsl:text>}&#10;</xsl:text>
</xsl:if>
<xsl:text>}}\\&#10;</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$pdfgen.metadata.typedocid = 'AMENDCOM'"/>
<xsl:when test="$pdfgen.metadata.typedocid = 'AMENDSCE'"/>
<xsl:when test="property[@name='auteurs'] != ''">
<!-- 2) Authors part -->
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont\relsize{-1}\uppercase{{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.depose_par"/>
<xsl:text>\textbf{</xsl:text>
<xsl:value-of select="property[@name='auteurs']"/>
<xsl:text>}}}\\&#10;</xsl:text>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<xsl:text>\rule{1.2cm}{1pt}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>}\end{center}&#10;</xsl:text>
<xsl:text>\vfill&#10;</xsl:text>
</xsl:if>
<xsl:if test="property[@name='commentaires'] != ''">
<xsl:text>\begin{center}\parbox[b][][c]{15cm}{&#10;</xsl:text>
<xsl:text>\begin{center}\renewcommand{\baselinestretch}{1.4}&#10;</xsl:text>
<xsl:text>\fontfamily{pun}\fontseries{m}\selectfont{</xsl:text>
<xsl:value-of select="$pdfgen.metadata.commentaires"/>
<xsl:text>}\\&#10;</xsl:text>
<xsl:text>\rule{1.2cm}{1pt}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>}\end{center}&#10;</xsl:text>
</xsl:if>
<!-- Bottom of the page -->
<xsl:text>\vfill&#10;</xsl:text>
<xsl:text>\end{changemargin}&#10;</xsl:text>
<xsl:if test="$with-toc">
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\tableofcontents&#10;</xsl:text>
<xsl:if test="//table/title">
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\listoftables&#10;</xsl:text>
</xsl:if>
<xsl:if test="//mediaobject/caption">
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\listoffigures&#10;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:text>\twocolumn&#10;</xsl:text>
</xsl:template>
<xsl:template name="apply-title-template">
<xsl:param name="template"/>
<xsl:param name="title" value=""/>
<xsl:param name="subtitle" value=""/>
<xsl:param name="footnote" value=""/>
<xsl:param name="authors" value=""/>
<xsl:variable name="result">
<xsl:call-template name="string-replace">
<xsl:with-param name="from">%__title__%</xsl:with-param>
<xsl:with-param name="to" select="$title"/>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="from">%__subtitle__%</xsl:with-param>
<xsl:with-param name="to" select="$subtitle"/>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="from">%__footnote__%</xsl:with-param>
<xsl:with-param name="to" select="$footnote"/>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="from">%__authors__%</xsl:with-param>
<xsl:with-param name="to" select="$authors"/>
<xsl:with-param name="string" select="$template"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$result" />
</xsl:template>
<xsl:template name="apply-template">
<xsl:param name="properties"/>
<xsl:param name="template"/>
<xsl:choose>
<xsl:when test="$properties">
<xsl:variable name="property" select="$properties[1]"/>
<xsl:variable name="result">
<xsl:call-template name="apply-template">
<xsl:with-param name="properties" select="$properties[position()!=1]"/>
<xsl:with-param name="template">
<xsl:call-template name="string-replace">
<xsl:with-param name="from">%<xsl:value-of select="$property/@name"/>%</xsl:with-param>
<xsl:with-param name="to"><xsl:value-of select="$property"/></xsl:with-param>
<xsl:with-param name="string"><xsl:value-of select="$template"/></xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$result" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$template" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

173
legi2pdf/xsl/image.xsl Normal file
View File

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: image.xsl -->
<!--
Purpose: New template to convert mediaobject to figure
The template generates LaTeX commands to include JPG or PNG if the .LEGI contents this type of files.
Otherwise the template generates LaTeX commands for PDF files (WMF->EPS->PDF see python script).
-->
<xsl:param name="bqr"/>
<xsl:template match="mediaobject">
<xsl:choose>
<xsl:when test="imageobject/imagedata[@format='JPG']">
<xsl:call-template name="generateForMedia">
<xsl:with-param name="imagedata" select="imageobject/imagedata[@format='JPG']"/>
<xsl:with-param name="mediaobject" select="."/>
<xsl:with-param name="fileref" select="imageobject/imagedata[@format='JPG']/@fileref"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="imageobject/imagedata[@format='PNG']">
<xsl:call-template name="generateForMedia">
<xsl:with-param name="imagedata" select="imageobject/imagedata[@format='PNG']"/>
<xsl:with-param name="mediaobject" select="."/>
<xsl:with-param name="fileref" select="imageobject/imagedata[@format='PNG']/@fileref"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- We specify a scale factor of 0.567 because the size/scale are no correct. -->
<xsl:call-template name="generateForMedia">
<xsl:with-param name="imagedata" select="imageobject/imagedata[@format='WMF']"/>
<xsl:with-param name="mediaobject" select="."/>
<xsl:with-param name="factor" select="string(0.567)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="generateForMedia">
<xsl:param name="imagedata"/>
<xsl:param name="mediaobject"/>
<xsl:param name="factor" select="string(1)"/>
<xsl:param name="fileref" select="substring-before($imagedata/@fileref, '.wmf')"/>
<xsl:if test="$fileref != ''">
<xsl:variable name="caption" select="$mediaobject/caption"/>
<xsl:variable name="captionTex">
<xsl:if test="$caption">
<xsl:value-of select="$latex.table.caption.style"/>
<xsl:text>\caption{</xsl:text>
<xsl:if test="$caption/@id">
<xsl:text>\label{</xsl:text>
<xsl:value-of select="$caption/@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:call-template name="label.id"/>
<xsl:apply-templates select="$caption" mode="caption.mode"/>
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:if test="$bqr">
<xsl:text>&#10;</xsl:text>
<xsl:text>\end{multicols}&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;\setlength{\mytempwidth}{</xsl:text>
<xsl:value-of select="$imagedata/@width"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\setlength{\mytempwidth}{</xsl:text>
<xsl:value-of select="$factor"/>
<xsl:text>\mytempwidth}&#10;</xsl:text>
<xsl:text>&#10;\setlength{\mytempdepth}{</xsl:text>
<xsl:value-of select="$imagedata/@depth"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\setlength{\mytempdepth}{</xsl:text>
<xsl:value-of select="$factor"/>
<xsl:text>\mytempdepth}&#10;</xsl:text>
<xsl:if test="$imagedata/@scalex">
<xsl:text>\setlength{\mytempwidth}{0.01\mytempwidth}&#10;</xsl:text>
<xsl:text>\setlength{\mytempwidth}{</xsl:text>
<xsl:value-of select="$imagedata/@scalex"/>
<xsl:text>\mytempwidth}&#10;</xsl:text>
</xsl:if>
<xsl:if test="$imagedata/@scaley">
<xsl:text>\setlength{\mytempdepth}{0.01\mytempdepth}&#10;</xsl:text>
<xsl:text>\setlength{\mytempdepth}{</xsl:text>
<xsl:value-of select="$imagedata/@scaley"/>
<xsl:text>\mytempdepth}&#10;</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$bqr">
<xsl:text>&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:if test="$mediaobject/caption">
<xsl:text>\bqrfigure{</xsl:text>
<xsl:apply-templates select="$mediaobject/caption" mode="caption.mode"/>
<xsl:text>}&#10;</xsl:text>
</xsl:if>
<xsl:text>\ifthenelse{\mytempwidth &lt; \textwidth}&#10;</xsl:text>
<xsl:text>{&#10;</xsl:text>
<xsl:text>\resizebox{\mytempwidth}{\mytempdepth}{\includegraphics{</xsl:text>
<xsl:value-of select="$fileref"/>
<xsl:text>}}&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>{&#10;</xsl:text>
<xsl:text>\resizebox{\textwidth}{!}{\includegraphics{</xsl:text>
<xsl:value-of select="$fileref"/>
<xsl:text>}}&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>\begin{multicols}{2}&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\ifthenelse{\mytempwidth &lt; \columnwidth}&#10;</xsl:text>
<xsl:text>{&#10;</xsl:text>
<xsl:text>\begin{figure}[htb]&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:value-of select="$captionTex"/>
<xsl:text>\resizebox{\mytempwidth}{\mytempdepth}{\includegraphics{</xsl:text>
<xsl:value-of select="$fileref"/>
<xsl:text>}}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>\end{figure}&#10;</xsl:text>
<xsl:text>}&#10;{&#10;\begin{figure*}[htb]&#10;</xsl:text>
<xsl:text>\begin{center}&#10;</xsl:text>
<xsl:value-of select="$captionTex"/>
<xsl:text>\ifthenelse{\mytempwidth &lt; \textwidth}&#10;</xsl:text>
<xsl:text>{&#10;</xsl:text>
<xsl:text>\resizebox{\mytempwidth}{\mytempdepth}{\includegraphics{</xsl:text>
<xsl:value-of select="$fileref"/>
<xsl:text>}}&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>{&#10;</xsl:text>
<xsl:text>\resizebox{\textwidth}{!}{\includegraphics{</xsl:text>
<xsl:value-of select="$fileref"/>
<xsl:text>}}&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>\end{figure*}&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

275
legi2pdf/xsl/legistic.xsl Normal file
View File

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: legistic.xsl -->
<!-- legisitic templates -->
<xsl:template name="extract.object.subtitle">
<xsl:param name="object" select="."/>
<xsl:choose>
<xsl:when test="$latex.apply.title.templates='1'">
<xsl:apply-templates select="$object/subtitle" mode="latex"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="normalize-scape">
<xsl:with-param name="string" select="$object/subtitle"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="startLegisticCounter_List">
<xsl:if test="not (preceding-sibling::*[contains(name(),'legistic')]) and not (ancestor::*[contains(name(),'legistic')])">
<xsl:text>&#10;% ------------------------ &#10;</xsl:text>
<xsl:text>% Debut d'une structure Legistique - </xsl:text>
<xsl:text>&#10;% ------------------------ &#10;</xsl:text>
<xsl:text>\legidebut&#10;</xsl:text>
</xsl:if>
</xsl:template>
<!-- template for legistic_section node -->
<xsl:template name="generate_legistic_section">
<xsl:param name="current_node" select="."/>
<xsl:param name="level"/>
<xsl:param name="latex-tag"/>
<xsl:call-template name="startLegisticCounter_List"/>
<xsl:param name="string1">
<xsl:call-template name="extract.object.title">
<xsl:with-param name="object" select="$current_node"/>
</xsl:call-template>
</xsl:param>
<xsl:param name="subtitle">
<xsl:call-template name="extract.object.subtitle">
<xsl:with-param name="object" select="$current_node"/>
</xsl:call-template>
</xsl:param>
<xsl:param name="use.label" select="1"/>
<xsl:param name="use.hypertarget" select="1"/>
<xsl:variable name="id">
<xsl:call-template name="generate.label.id">
<xsl:with-param name="object" select="$current_node"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$string1=''">
<xsl:call-template name="gentext.element.name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($string1)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:param name="title-toc">
<xsl:apply-templates select="$current_node/title" mode="toc"/>
</xsl:param>
<xsl:param name="subtitle-toc">
<xsl:apply-templates select="$current_node/subtitle" mode="toc"/>
</xsl:param>
<xsl:if test="not($current_node[position()=2])">
<xsl:text>\pagebreak[2]&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;% ------------------------ &#10;</xsl:text>
<xsl:text>% begin legistique - </xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>)&#10;\</xsl:text>
<xsl:value-of select="$latex-tag"/>
<xsl:text>{</xsl:text>
<xsl:value-of select="$title-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>}</xsl:text>
<xsl:text>&#10;\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
<xsl:call-template name="content-templates"/>
<xsl:text>% end legistique -</xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>)&#10;</xsl:text>
<xsl:text>% ------------------------ &#10;</xsl:text>
</xsl:template>
<xsl:template match="legistic_part">
<xsl:call-template name="generate_legistic_section">
<xsl:with-param name="current_node" select="."/>
<xsl:with-param name="level">Legistique Partie</xsl:with-param>
<xsl:with-param name="latex-tag">legipart</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="legistic_book">
<xsl:call-template name="generate_legistic_section">
<xsl:with-param name="current_node" select="."/>
<xsl:with-param name="level">Legistique Livre</xsl:with-param>
<xsl:with-param name="latex-tag">legilivre</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="legistic_title">
<xsl:call-template name="generate_legistic_section">
<xsl:with-param name="current_node" select="."/>
<xsl:with-param name="level">Legistique Titre</xsl:with-param>
<xsl:with-param name="latex-tag">legititre</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="legistic_chapter">
<xsl:call-template name="generate_legistic_section">
<xsl:with-param name="current_node" select="."/>
<xsl:with-param name="level">Legistique Chapitre</xsl:with-param>
<xsl:with-param name="latex-tag">legichapitre</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="legistic_section">
<xsl:call-template name="generate_legistic_section">
<xsl:with-param name="current_node" select="."/>
<xsl:with-param name="level">Legistique Section</xsl:with-param>
<xsl:with-param name="latex-tag">legisection</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="legistic_subsection">
<xsl:call-template name="generate_legistic_section">
<xsl:with-param name="current_node" select="."/>
<xsl:with-param name="level">Legistique Sous-section</xsl:with-param>
<xsl:with-param name="latex-tag">legisoussection</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- template for legistic_section node -->
<xsl:template match="legistic_section_old">
<xsl:param name="level" select="count(ancestor::legistic_section)+1"/>
<xsl:param name="string1">
<xsl:call-template name="extract.object.title">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:param>
<xsl:param name="subtitle">
<xsl:call-template name="extract.object.subtitle">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:param>
<xsl:param name="use.label" select="1"/>
<xsl:param name="use.hypertarget" select="1"/>
<xsl:variable name="id">
<xsl:call-template name="generate.label.id">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$string1=''">
<xsl:call-template name="gentext.element.name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($string1)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:param name="title-toc">
<xsl:apply-templates select="./title" mode="toc"/>
</xsl:param>
<xsl:param name="subtitle-toc">
<xsl:apply-templates select="./subtitle" mode="toc"/>
</xsl:param>
<xsl:param name="section-tag">
<xsl:choose>
<xsl:when test='$level = 1'>
<xsl:text>legisection</xsl:text>
</xsl:when>
<xsl:when test='$level = 2'>
<xsl:text>legisubsection</xsl:text>
</xsl:when>
<xsl:when test='$level = 3'>
<xsl:text>legisubsubsection</xsl:text>
</xsl:when>
<xsl:when test='$level = 4'>
<xsl:text>legiparagraph</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>legisubparagraph</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:text>&#10;% ------------------------ &#10;</xsl:text>
<xsl:text>% begin legistic section (level: </xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>)&#10;\</xsl:text>
<xsl:value-of select="$section-tag"/>
<xsl:text>{</xsl:text>
<xsl:value-of select="$title-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$subtitle-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$subtitle"/>
<xsl:text>}</xsl:text>
<xsl:text>&#10;\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
<xsl:call-template name="content-templates"/>
<xsl:text>% end legistic section (level: </xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>)&#10;</xsl:text>
<xsl:text>% ------------------------ &#10;</xsl:text>
</xsl:template>
<xsl:template match="legistic_article">
<xsl:call-template name="startLegisticCounter_List"/>
<xsl:text>&#10;</xsl:text>
<xsl:text>\legiarticle&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="legistic_manualarticle">
<xsl:call-template name="startLegisticCounter_List"/>
<xsl:text>&#10;</xsl:text>
<xsl:text>\legimanualarticle{</xsl:text>
<xsl:value-of select="."/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<!DOCTYPE latexbindings SYSTEM "../../latex.mapping.dtd" []>
<latexbindings>
<!-- LaTeX mapping, role, BEGIN -->
<latexmapping role="begin">
<mapping key="part" text="">
<line>% ------------------------------------------------------------- &#10;</line>
<line>% &#10;</line>
<line>% PART %title%&#10;</line>
<line>% &#10;</line>
<line>% ------------------------------------------------------------- &#10;</line>
<line>\setcounter{section}{0}&#10;</line>
<line>\twocolumn[\part*{%title%}&#10;</line>
<line>\label{%id%}\hypertarget{%id%}{}%&#10;</line>
<line>\centerline{bla bla bla}]&#10;</line>
</mapping>
<mapping key="appendix" text="">
<line>&#10;</line>
<line>% -------------------------------------------------------------&#10;</line>
<line>% appendix: %title% &#10;</line>
<line>% ------------------------------------------------------------- &#10;</line>
<line>\twocolumn[\dbappendix{%title%}&#10;</line>
<line>\label{%id%}\hypertarget{%id%}{}%&#10;</line>
<line>\centerline{bla bla bla}]&#10;</line>
</mapping>
<mapping key="preface" text="">
<line>% -------------------------------------------------------------&#10;</line>
<line>% Preface &#10;</line>
<line>% -------------------------------------------------------------&#10;</line>
<line>\makeatletter&#10;</line>
<line>\let\save@makeschapterhead\@makeschapterhead&#10;</line>
<line>\def\@makeschapterhead{\vspace*{-80pt}\save@makeschapterhead}&#10;</line>
<line>\section*{\uppercase{%title%}}\let\@makeschapterhead\save@makeschapterhead\makeatother%&#10;</line>
<line>\label{%id%}\hypertarget{%id%}{}%&#10;</line>
</mapping>
</latexmapping>
<latexmapping role="end">
<mapping key="article" text="">
<line>%\balance&#10;</line>
<line>\end{document}&#10;</line>
</mapping>
<mapping key="book" text="">
<line>&#10;</line>
<line>%\balance&#10;</line>
<line>\end{document}&#10;</line>
<line>&#10;</line>
</mapping>
</latexmapping>
</latexbindings>

142
legi2pdf/xsl/main.xsl Normal file
View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: main.xsl -->
<!--
Purpose: Entry point for the docbook to latex filter.
Import the db2latex stylesheets then the customization.
Re-define the entry point to create a 'root' node (there is
a post-processing phase)
-->
<!-- Import db2latex stylesheets -->
<xsl:import href="./db2latex/xsl/docbook.xsl"/>
<!-- Import stylesheet to customize db2latex (redefinition of Db2Latex default value) -->
<xsl:import href="db2latex_custom.xsl"/>
<!-- Import stylesheet to produce the first page -->
<xsl:import href="first_page.xsl"/>
<!-- Import stylesheet to generate table object -->
<xsl:import href="table.xsl"/>
<!-- Import stylesheet to generate image object -->
<xsl:import href="image.xsl"/>
<!-- Import stylesheet to control section (db2latex doesn't support footnote inside section/title) -->
<xsl:import href="section.xsl"/>
<!-- Import stylesheet to define miscellaneous templates: speech / ... -->
<xsl:import href="misc.xsl"/>
<!-- Import stylesheet to control legistic items -->
<xsl:import href="legistic.xsl"/>
<!-- Import stylesheet to control appendix insertion -->
<xsl:import href="appendix.xsl"/>
<!-- The output method is 'xml' due to the post-processing phase to convert euro tag -->
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:variable name="table-width-threshold" select="'225'"/>
<!-- Entry point of the docbook to latex filter -->
<xsl:template match="/">
<xsl:message>--------------------------------------------</xsl:message>
<xsl:message> DOCBOOK To LaTeX filter</xsl:message>
<xsl:message> Version: 0.1</xsl:message>
<xsl:message>--------------------------------------------</xsl:message>
<xsl:element name="root">
<xsl:variable name="xsl-vendor" select="system-property('xsl:vendor')"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="caption" mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<!--xsl:param name="name">
<xsl:choose>
<xsl:when test="contains(local-name(parent::*), 'info')">
<xsl:call-template name="xpath.location">
<xsl:with-param name="node" select="../.."/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="xpath.location">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:param-->
<xsl:param name="name">figure</xsl:param>
<xsl:message>referrer <xsl:value-of select="$referrer"/></xsl:message>
<xsl:message>purpose <xsl:value-of select="$purpose"/></xsl:message>
<xsl:message>xrefstyle <xsl:value-of select="$xrefstyle"/></xsl:message>
<xsl:message>name <xsl:value-of select="$name"/></xsl:message>
<xsl:variable name="template">
<xsl:variable name="user-template">
<xsl:if test="$xrefstyle != '' and not(contains($xrefstyle, ':'))">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="$xrefstyle"/>
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:variable name="context">
<xsl:choose>
<xsl:when test="$user-template = 1">
<xsl:value-of select="$xrefstyle"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'title'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
<xsl:text>. %t</xsl:text>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

248
legi2pdf/xsl/misc.xsl Normal file
View File

@ -0,0 +1,248 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: misc.xsl -->
<!--
Purpose: Customize Db2Latex product for:
o literallayout: not supported by Db2Latex
o speech: not docbook
o footnote: customization for table
generate \tnote instead of \footnote
-->
<xsl:template match="emphasis">
<xsl:param name="content">
<xsl:apply-templates/>
</xsl:param>
<xsl:text>{\em{</xsl:text>
<xsl:copy-of select="$content"/>
<xsl:text>}}</xsl:text>
</xsl:template>
<xsl:template match="emphasis[@role='bold']">
<xsl:text>{\bfseries{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}}</xsl:text>
</xsl:template>
<xsl:template match="emphasis[@role='underline']">
<xsl:param name="content">
<xsl:apply-templates/>
</xsl:param>
<xsl:text>{\uline{</xsl:text>
<xsl:copy-of select="$content"/>
<xsl:text>}}</xsl:text>
</xsl:template>
<xsl:template match="orderedlist">
<xsl:variable name="numeration">
<xsl:choose>
<xsl:when test="@numeration">
<xsl:value-of select="@numeration"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="arabic"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates select="node()[not(self::listitem)]"/>
<xsl:text>&#10;\begin{enumerate}</xsl:text>
<xsl:if test="@numeration">
<xsl:choose>
<xsl:when test="@numeration='arabic'"> <xsl:text>[1{\textsuperscript{o}}]</xsl:text>&#10;</xsl:when>
<xsl:when test="@numeration='upperalpha'"><xsl:text>[A]</xsl:text>&#10;</xsl:when>
<xsl:when test="@numeration='loweralpha'"><xsl:text>[a{)}]</xsl:text>&#10;</xsl:when>
<xsl:when test="@numeration='upperroman'"><xsl:text>[I]</xsl:text>&#10;</xsl:when>
<xsl:when test="@numeration='lowerroman'"><xsl:text>[i]</xsl:text>&#10;</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:apply-templates select="listitem"/>
<xsl:text>\end{enumerate}&#10;</xsl:text>
</xsl:template>
<!-- literallayout template -->
<xsl:template match="literallayout">
<xsl:text>&#10;\begin{literallayout}&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;\end{literallayout}&#10;</xsl:text>
</xsl:template>
<!-- speech template -->
<xsl:template match="note">
<xsl:text>&#10;\begin{center}&#10;</xsl:text>
<xsl:text>\fontshape{it}\selectfont&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;\normalfont&#10;</xsl:text>
<xsl:text>&#10;\end{center}&#10;</xsl:text>
</xsl:template>
<!-- speech template -->
<xsl:template match="speech">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="speech/ref" />
<xsl:template match="bqr_objet">
<xsl:text>Objet : </xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:template>
<!-- itemizedlist template -->
<xsl:template match="itemizedlist">
<xsl:apply-templates select="node()[not(self::listitem)]"/>
<xsl:variable name="level" select="count(ancestor-or-self::itemizedlist)"/>
<xsl:choose>
<xsl:when test="$level='1'">
<xsl:text>&#10;\begin{itemizedlist1}</xsl:text>
<xsl:apply-templates select="listitem"/>
<xsl:text>\end{itemizedlist1}&#10;</xsl:text>
</xsl:when>
<xsl:when test="$level='2'">
<xsl:text>&#10;\begin{itemizedlist2}</xsl:text>
<xsl:apply-templates select="listitem"/>
<xsl:text>\end{itemizedlist2}&#10;</xsl:text>
</xsl:when>
<xsl:when test="$level='3'">
<xsl:text>&#10;\begin{itemizedlist3}</xsl:text>
<xsl:apply-templates select="listitem"/>
<xsl:text>\end{itemizedlist3}&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#10;\begin{itemize}</xsl:text>
<xsl:apply-templates select="listitem"/>
<xsl:text>\end{itemize}&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="footnote">
<xsl:variable name="table" select="ancestor::table"/>
<xsl:variable name="emphasis" select="ancestor::emphasis[@role='underline']"/>
<xsl:choose>
<xsl:when test="$table">
<xsl:variable name="table.type">
<xsl:call-template name="table.get-type">
<xsl:with-param name="table" select="$table"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$table.type = '1'">
<xsl:variable name="cur-footnote-node" select="."/>
<xsl:variable name="footnote-index">
<xsl:for-each select="ancestor::table//footnote">
<xsl:if test="$cur-footnote-node = .">
<xsl:value-of select="position()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:text>\tnote{</xsl:text>
<xsl:number value="$footnote-index" format="a" />
<!--xsl:value-of select="$footnote-index"/ -->
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="label.id"/>
<xsl:text>\begingroup\catcode`\#=12\footnote{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}\endgroup\docbooktolatexmakefootnoteref{</xsl:text>
<xsl:call-template name="generate.label.id"/>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$emphasis">
<xsl:text>}}</xsl:text>
<xsl:call-template name="label.id"/>
<xsl:text>\begingroup\catcode`\#=12\footnote{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}\endgroup\docbooktolatexmakefootnoteref{</xsl:text>
<xsl:call-template name="generate.label.id"/>
<xsl:text>}</xsl:text>
<xsl:text>{\uline{</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="label.id"/>
<xsl:text>\begingroup\catcode`\#=12\footnote{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}\endgroup\docbooktolatexmakefootnoteref{</xsl:text>
<xsl:call-template name="generate.label.id"/>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="footnote-syntax-replace">
<xsl:param name="string"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="from">[%</xsl:with-param>
<xsl:with-param name="to">\footnote{</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="from">%]</xsl:with-param>
<xsl:with-param name="to">}</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="footnote-syntax-replace-protect-from-uppercase">
<xsl:param name="string"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="from">[%</xsl:with-param>
<xsl:with-param name="to">}\footnote{</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="from">%]</xsl:with-param>
<xsl:with-param name="to">}\uppercase{</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="escape-percent">
<xsl:param name="string"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="from">%</xsl:with-param>
<xsl:with-param name="to">\%</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:output method="text" encoding="utf-8" indent="yes"/>
<!-- FileName: post_proc.xsl -->
<!--
Purpose: Post-processing rules to transform the '&#x20AC;' character (euro)
to the \euro latex command.
-->
<xsl:template name="string-replace">
<xsl:param name="string"/>
<xsl:param name="pattern"/>
<xsl:param name="replacement"/>
<xsl:choose>
<xsl:when test="$pattern != '' and $string != '' and contains($string, $pattern)">
<xsl:value-of select="substring-before($string, $pattern)"/>
<xsl:copy-of select="$replacement"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="substring-after($string, $pattern)"/>
<xsl:with-param name="pattern" select="$pattern"/>
<xsl:with-param name="replacement" select="$replacement"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="//text()">
<xsl:call-template name="string-replace">
<xsl:with-param name="pattern">&#x20AC;</xsl:with-param>
<xsl:with-param name="replacement">\euro\space</xsl:with-param>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="pattern">&#x2019;</xsl:with-param>
<xsl:with-param name="replacement">'</xsl:with-param>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="pattern">&#x201C;</xsl:with-param>
<xsl:with-param name="replacement">\guillemotleft</xsl:with-param>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="pattern">&#x201D;</xsl:with-param>
<xsl:with-param name="replacement">\guillemotright</xsl:with-param>
<xsl:with-param name="string">
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="."/>
<xsl:with-param name="pattern">&#x2011;</xsl:with-param>
<xsl:with-param name="replacement">-</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="/root">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>

80
legi2pdf/xsl/pre_proc.xsl Normal file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<!-- FileName: pre_proc.xsl -->
<!--
Purpose: Preprocessing rules to transform the chapter / sect(xxx)
to section.
-->
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="chapter|sect1|sect2|sect3|sect4|sect5|sect6">
<xsl:element name="section">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="informaltable">
<xsl:element name="table">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="para">
<xsl:choose>
<xsl:when test="@role='objet'">
<xsl:element name="bqr_objet">
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:when test="@role='legistic_article'">
<xsl:element name="legistic_article">
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:when test="@role='legistic_manualarticle'">
<xsl:element name="legistic_manualarticle">
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="para">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

311
legi2pdf/xsl/section.xsl Normal file
View File

@ -0,0 +1,311 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: section.xsl -->
<!--
Purpose: Correct Db2Latex product to take into account the footnote
inside the title of a section.
Instead of \section{title}, this template generates \section[title-for-toc]{title}
'title-for-toc' (text for table of content) is similar as 'title' but without footnote.
-->
<!-- templates customization of 'toc' mode; use for 'title-for-toc' definition -->
<xsl:template match="footnote" mode="toc"/>
<xsl:template match="ulink" mode="toc"/>
<xsl:template match="link" mode="toc"/>
<xsl:template match="anchor" mode="toc"/>
<xsl:template match="ref" mode="toc"/>
<xsl:param name="bqr"/>
<!-- template for section node -->
<xsl:template match="preface">
<xsl:if test="./title">
<xsl:call-template name="map.begin"/>
</xsl:if>
<xsl:call-template name="content-templates"/>
<xsl:call-template name="map.end"/>
</xsl:template>
<xsl:template name="extract.object.subtitle">
<xsl:param name="object" select="."/>
<xsl:choose>
<xsl:when test="$latex.apply.title.templates='1'">
<xsl:apply-templates select="$object/subtitle" mode="latex"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="normalize-scape">
<xsl:with-param name="string" select="$object/subtitle"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section">
<xsl:param name="bridgehead" select="ancestor::preface|ancestor::colophon|ancestor::dedication"/>
<xsl:param name="level" select="count(ancestor::section)+1"/>
<xsl:param name="string">
<xsl:call-template name="extract.object.title">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:param>
<xsl:param name="use.label" select="1"/>
<xsl:param name="use.hypertarget" select="1"/>
<xsl:variable name="id">
<xsl:call-template name="generate.label.id">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="starts-with(local-name(.),'informal')">
<xsl:if test="$string!=''">
<xsl:message>Ignoring title for <xsl:value-of select="local-name($object)"/>.</xsl:message>
</xsl:if>
</xsl:when>
<xsl:when test="$string=''">
<xsl:call-template name="gentext.element.name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($string)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:param name="title-toc">
<xsl:choose>
<xsl:when test='$level = 2'>
<xsl:choose>
<xsl:when test='$bqr'>
<xsl:apply-templates select="./bqr_objet" mode="toc"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./title" mode="toc"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./title" mode="toc"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="section-tag">
<xsl:choose>
<xsl:when test='($level = 1) and ($bqr)'>
<xsl:text>bqrsection</xsl:text>
</xsl:when>
<xsl:when test='($level = 1) and not($bqr)'>
<xsl:text>section</xsl:text>
</xsl:when>
<xsl:when test='$level = 2'>
<xsl:text>subsection</xsl:text>
</xsl:when>
<xsl:when test='$level = 3'>
<xsl:text>subsubsection</xsl:text>
</xsl:when>
<xsl:when test='$level = 4'>
<xsl:text>paragraph</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>subparagraph</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="begin-param-tag">
<xsl:choose>
<xsl:when test='($level = 1) and ($bqr)'>
<xsl:text>{</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>[</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="end-param-tag">
<xsl:choose>
<xsl:when test='($level = 1) and ($bqr)'>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>]</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:if test="not(node()[position()=2])">
<xsl:text>\pagebreak[2]&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;% ------------------------ &#10;</xsl:text>
<xsl:text>% begin section (level: </xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>)&#10;\</xsl:text>
<xsl:value-of select="$section-tag"/>
<xsl:if test="$bridgehead"><xsl:text>*</xsl:text></xsl:if>
<xsl:value-of select="$begin-param-tag"/>
<xsl:value-of select="$title-toc"/>
<xsl:value-of select="$end-param-tag"/>
<xsl:text>{</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>}&#10;\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
<xsl:if test="$bqr">
<xsl:if test="$level = 1">
<xsl:message>begin{multicols}</xsl:message>
<xsl:text>\begin{multicols}{2}&#10;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:call-template name="content-templates"/>
<xsl:if test="$bqr">
<xsl:if test="$level = 1">
<xsl:message>end{multicols}</xsl:message>
<xsl:text>\end{multicols}&#10;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:text>% end section (level: </xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>)&#10;</xsl:text>
<xsl:text>% ------------------------ &#10;</xsl:text>
</xsl:template>
<xsl:template match="part">
<xsl:param name="bridgehead" select="ancestor::preface|ancestor::colophon|ancestor::dedication"/>
<xsl:param name="string">
<xsl:call-template name="extract.object.title">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:param>
<xsl:param name="use.label" select="1"/>
<xsl:param name="use.hypertarget" select="1"/>
<xsl:variable name="id">
<xsl:call-template name="generate.label.id">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="starts-with(local-name(.),'informal')">
<xsl:if test="$string!=''">
<xsl:message>Ignoring title for <xsl:value-of select="local-name($object)"/>.</xsl:message>
</xsl:if>
</xsl:when>
<xsl:when test="$string=''">
<xsl:call-template name="gentext.element.name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($string)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:param name="subtitle">
<xsl:call-template name="extract.object.subtitle">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:param>
<xsl:param name="title-toc">
<xsl:apply-templates select="./title" mode="toc"/>
</xsl:param>
<xsl:param name="subtitle-toc">
<xsl:apply-templates select="./subtitle" mode="toc"/>
</xsl:param>
<xsl:if test="starts-with(translate($title-toc, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'AVANT-PROJET DE ')">
<xsl:text>\sfont&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<xsl:text>%\balance&#10;</xsl:text>
<xsl:text>% ------------------------------------------------------------- &#10;</xsl:text>
<xsl:text>% PART: </xsl:text>
<xsl:value-of select="$title-toc"/>
<xsl:text>&#10;</xsl:text>
<xsl:text>%&#10;</xsl:text>
<xsl:text>% ------------------------------------------------------------- &#10;</xsl:text>
<xsl:text>\setcounter{section}{0}&#10;</xsl:text>
<xsl:choose>
<xsl:when test='$bqr'>
<xsl:text>\onecolumn</xsl:text>
<xsl:text>\bqrpart{</xsl:text>
<xsl:value-of select="$title-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$subtitle-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$subtitle"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\twocolumn[\pcfpart{</xsl:text>
<xsl:value-of select="$title-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$subtitle-toc"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$subtitle"/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\label{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}\hypertarget{</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>}{}%&#10;]</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="content-templates"/>
<xsl:text>% end part &#10;</xsl:text>
<xsl:text>% ------------------------ &#10;</xsl:text>
<xsl:if test="starts-with(translate($title-toc, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'AVANT-PROJET DE ')">
<xsl:text>\nfont&#10;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

452
legi2pdf/xsl/table.xsl Normal file
View File

@ -0,0 +1,452 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- FileName: table.xsl -->
<!--
Purpose: Customize Db2Latex product for table; the major differences are:
o Generate a table across the two columns or inside one column
depending on the total width of the table columns.
o Adapt the width of the table columns depending on the width of
the page column (two columns style) or the width of the entire page.
o Generate a floating element
o Generate a threeparttable
-->
<!-- Sum the width of table columns -->
<!-- Hypothesis: the width is given using 'pt' metric -->
<xsl:param name="bqr"/>
<xsl:template name="table.sum-width">
<xsl:param name="list"/>
<xsl:choose>
<xsl:when test="$list">
<xsl:variable name="width" select="substring-before($list[1], 'pt')"/>
<xsl:variable name="otherWidth">
<!-- Recursive for next column -->
<xsl:call-template name="table.sum-width">
<xsl:with-param name="list" select="$list[position() != 1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$otherWidth + $width"/>
</xsl:when>
<!-- Out of the recursive iteration -->
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="table.get-type">
<xsl:param name="table" value="."/>
<xsl:variable name="total-width">
<xsl:call-template name="table.sum-width">
<xsl:with-param name="list" select="$table/tgroup[1]/colspec/@colwidth"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<!-- xsl:when test="$total-width &lt; $table-width-threshold">0</xsl:when -->
<xsl:when test="$bqr">0</xsl:when>
<xsl:when test="($total-width &gt; $table-width-threshold) and ($table/@role = 'long')">2</xsl:when>
<xsl:when test="$total-width &gt; $table-width-threshold">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Generate the latex specification of the table column p{width-specification}... -->
<xsl:template name="table.format.tabular">
<xsl:variable name="cols">
<xsl:choose>
<xsl:when test="@cols">
<xsl:value-of select="@cols"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(tbody/row[1]/entry)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="total-width">
<xsl:call-template name="table.sum-width">
<xsl:with-param name="list" select="./colspec/@colwidth"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="table.generate.format.tabular">
<xsl:with-param name="cols" select="$cols"/>
<xsl:with-param name="colsep" select="0"/>
<xsl:with-param name="total-width" select="$total-width"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="table.generate.format.tabular">
<xsl:param name="cols" select="1"/>
<xsl:param name="i" select="1"/>
<xsl:param name="colsep" select="0"/>
<xsl:param name="total-width"/>
<xsl:choose>
<!-- Out of the recursive iteration -->
<xsl:when test="$i > $cols"></xsl:when>
<!-- There are still columns to count -->
<xsl:otherwise>
<!-- define the width of the current column:
'$currentWidth div $totalWidth'\mytablewidth
where 'mytablewidth' is a latex length taking into account
the width available for the columns
-->
<xsl:variable name="width-specification">
<xsl:variable name="current-width">
<xsl:choose>
<xsl:when test="substring-before(./colspec[@colnum=$i], 'pt')">
<xsl:value-of select="./colspec[@colnum=$i]/@colwidth"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before(./colspec[position()=$i]/@colwidth, 'pt')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="cells" select="thead/row/entry[$i]|tbody/row/entry[$i]"/>
<xsl:value-of select="concat($current-width div $total-width,'\mytablewidth')"/>
</xsl:variable>
<!-- Keep the @align attribute of the colspec node -->
<xsl:variable name="useralign">
<xsl:choose>
<xsl:when test="./colspec[@colnum=$i]">
<xsl:value-of select="./colspec[@colnum=$i]/@align"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./colspec[position()=$i]/@align"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$useralign='left'"><xsl:text>&gt;{\RaggedRight}</xsl:text></xsl:when>
<xsl:when test="$useralign='right'"><xsl:text>&gt;{\RaggedLeft}</xsl:text></xsl:when>
<xsl:when test="$useralign='center'"><xsl:text>&gt;{\Centering}</xsl:text></xsl:when>
<xsl:when test="$useralign='char'"><xsl:message>Table column 'char' alignment is not supported when width specified.</xsl:message></xsl:when>
<xsl:when test="$useralign!=''"><xsl:message>Table column '<xsl:value-of select="$useralign"/>' alignment is not supported.</xsl:message></xsl:when>
</xsl:choose>
<xsl:text>p{</xsl:text><xsl:value-of select="$width-specification" /><xsl:text>}</xsl:text>
<xsl:if test="$i&lt;$cols and $colsep='1'">
<xsl:text>|</xsl:text>
</xsl:if>
<!-- Recursive for next column -->
<xsl:call-template name="table.generate.format.tabular">
<xsl:with-param name="i" select="$i+1"/>
<xsl:with-param name="cols" select="$cols"/>
<xsl:with-param name="colsep" select="$colsep"/>
<xsl:with-param name="total-width" select="$total-width"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Template to generate the row of the table body
Remark: no \hline is generated
-->
<xsl:template match="tbody/row">
<xsl:apply-templates/>
<xsl:text> \tabularnewline&#10;</xsl:text>
</xsl:template>
<!-- Template to generate the row of the table header
Remark: \hline are generated before and after the header rows
-->
<xsl:template match="thead/row">
<xsl:apply-templates/>
<xsl:text> \tabularnewline&#10;</xsl:text>
</xsl:template>
<!-- Template to generate the row of the table footer
Remark: \hline are generated before and after the footer rows
-->
<xsl:template match="tfoot/row">
<xsl:apply-templates/>
<xsl:text> \tabularnewline&#10;</xsl:text>
</xsl:template>
<!-- Template to generate the content of the mpsupertabular table
Hypothesis: only one tgroup per table
-->
<xsl:template match="tgroup" mode="mpsupertabular">
<xsl:variable name="colspecs" select="./colspec"/>
<xsl:variable name="align" select="@align"/>
<xsl:variable name="colsep">0</xsl:variable>
<!-- APPLY TEMPLATES -->
<xsl:choose>
<xsl:when test="thead">
<xsl:text>\tablefirsthead{&#10;</xsl:text>
<xsl:text>\hline&#10;</xsl:text>
<xsl:apply-templates select="thead"/>
<xsl:text>\hline&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\tablehead{&#10;</xsl:text>
<xsl:text>\hline&#10;</xsl:text>
<xsl:apply-templates select="thead"/>
<xsl:text>\hline&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\tablefirsthead{}&#10;</xsl:text>
<xsl:text>\tablehead{}&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\begin{mpsupertabular}{</xsl:text>
<xsl:call-template name="table.format.tabular"/>
<xsl:text>}&#10;</xsl:text>
<xsl:apply-templates select="tbody"/>
<xsl:text>\end{mpsupertabular}&#10;</xsl:text>
</xsl:template>
<!-- Template to generate the content of the threeparttable table
Hypothesis: only one tgroup per table
-->
<xsl:template match="tgroup" mode="threeparttable">
<xsl:variable name="colspecs" select="./colspec"/>
<xsl:variable name="align" select="@align"/>
<xsl:variable name="colsep">0</xsl:variable>
<!-- APPLY TEMPLATES -->
<xsl:text>\begin{threeparttable}&#10;</xsl:text>
<xsl:text>\begin{tabular}{</xsl:text>
<xsl:call-template name="table.format.tabular"/>
<xsl:text>}&#10;</xsl:text>
<xsl:if test="thead">
<xsl:text>\hline &#10;</xsl:text>
<xsl:apply-templates select="thead"/>
<xsl:text>\hline &#10;</xsl:text>
</xsl:if>
<xsl:apply-templates select="tbody"/>
<xsl:text>\end{tabular}&#10;</xsl:text>
<xsl:if test=".//footnote">
<xsl:text>\rule{1.8cm}{1pt}&#10;</xsl:text>
<xsl:text>\begin{tablenotes}&#10;</xsl:text>
<xsl:call-template name="table-footnote-generation">
<xsl:with-param name="footnotes" select=".//footnote"/>
<xsl:with-param name="index" select="1"/>
</xsl:call-template>
<xsl:text>\end{tablenotes}&#10;</xsl:text>
</xsl:if>
<xsl:text>\end{threeparttable}&#10;</xsl:text>
</xsl:template>
<!-- Template to generate the footnotes just after the table
-->
<xsl:template name="table-footnote-generation">
<xsl:param name="footnotes"/>
<xsl:param name="index" select="1"/>
<xsl:choose>
<xsl:when test="$index > count($footnotes)">
</xsl:when>
<xsl:otherwise>
<xsl:text>\item[</xsl:text>
<xsl:number value="$index" format="a" />
<xsl:text>] {</xsl:text>
<xsl:apply-templates select="$footnotes[$index]/*"/>
<xsl:text>}</xsl:text>
<xsl:call-template name="table-footnote-generation">
<xsl:with-param name="footnotes" select="$footnotes"/>
<xsl:with-param name="index" select="$index+1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Entry rule for table generation
-->
<xsl:template match="table">
<xsl:variable name="placement">
<xsl:call-template name="generate.formal.title.placement">
<xsl:with-param name="object" select="local-name(.)" />
</xsl:call-template>
</xsl:variable>
<!-- Keep the table position specification (default: htb) -->
<xsl:variable name="position">
<xsl:choose>
<xsl:when test="@condition">
<xsl:value-of select="@condition"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>htb</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="table.type">
<xsl:call-template name="table.get-type">
<xsl:with-param name="table" select="."/>
</xsl:call-template>
</xsl:variable>
<!-- Keep the caption -->
<xsl:variable name="table.caption.mpsupertabular">
<xsl:choose>
<xsl:when test="title">
<xsl:value-of select="$latex.table.caption.style"/>
<xsl:text>\tablecaption{</xsl:text>
<xsl:if test="title/@id">
<xsl:text>\label{</xsl:text>
<xsl:value-of select="title/@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:call-template name="label.id"/>
<xsl:apply-templates select="title" mode="caption.mode"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="table.caption.threeparttable">
<xsl:choose>
<xsl:when test="title">
<xsl:value-of select="$latex.table.caption.style"/>
<xsl:text>\caption{</xsl:text>
<xsl:if test="title/@id">
<xsl:text>\label{</xsl:text>
<xsl:value-of select="title/@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:call-template name="label.id"/>
<xsl:apply-templates select="title" mode="caption.mode"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Calculate the total width of the table -->
<xsl:variable name="total-width">
<xsl:call-template name="table.sum-width">
<xsl:with-param name="list" select="./tgroup[1]/colspec/@colwidth"/>
</xsl:call-template>
</xsl:variable>
<!-- Keep the number of columns -->
<xsl:variable name="nbr-cols">
<xsl:choose>
<xsl:when test="./tgroup[1]/@cols">
<xsl:value-of select="./tgroup[1]/@cols"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(./tgroup[1]/tbody/row[1]/entry)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Core part of the template: Code generation -->
<xsl:text>&#10;</xsl:text>
<xsl:text>% Begin table definition &#10;</xsl:text>
<xsl:text>% ------------------------ &#10;&#10;</xsl:text>
<xsl:if test='$bqr'>
<xsl:text>\end{multicols}&#10;</xsl:text>
<xsl:text>\begin{changemargin}{1cm}{1cm}&#10;</xsl:text>
</xsl:if>
<xsl:text>\setlength{\mytempvalue}{</xsl:text>
<xsl:value-of select="concat($total-width,'pt')"/>
<xsl:text>}&#10;</xsl:text>
<xsl:choose>
<xsl:when test="$table.type = '1'"> <!-- flotting type -->
<xsl:text>% The table is floating -> threeparttable inside a floating element &#10;</xsl:text>
<xsl:text>\setlength{\mytablewidth}{\textwidth}&#10;</xsl:text>
<xsl:text>\addtolength{\mytablewidth}{-</xsl:text>
<xsl:value-of select="$nbr-cols * 2"/>
<xsl:text>\tabcolsep}&#10;</xsl:text>
<xsl:text>\begin{table*}[htb]</xsl:text>
<xsl:value-of select="$table.caption.threeparttable" />
<xsl:text>&#10;%&#10;%&#10;%&#10;</xsl:text>
<xsl:apply-templates select="tgroup[1]" mode="threeparttable"/>
<xsl:text>\end{table*}</xsl:text>
</xsl:when>
<xsl:when test="$table.type = '2'"> <!-- long and broad table -->
<xsl:text>% The table is not floating but broad and long -> mpsupertabular with page break&#10;</xsl:text>
<xsl:text>%\balance&#10;</xsl:text>
<xsl:text>\onecolumn&#10;</xsl:text>
<xsl:text>\setlength{\mytablewidth}{\textwidth}&#10;</xsl:text>
<xsl:text>\addtolength{\mytablewidth}{-</xsl:text>
<xsl:value-of select="$nbr-cols * 2"/>
<xsl:text>\tabcolsep}&#10;</xsl:text>
<xsl:value-of select="$table.caption.mpsupertabular" />
<xsl:text>&#10;%&#10;%&#10;%&#10;</xsl:text>
<xsl:apply-templates select="tgroup[1]" mode="mpsupertabular"/>
<xsl:text>\twocolumn</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>% The table is not floating: using mpsupertabular&#10;</xsl:text>
<xsl:text>\setlength{\mytablewidth}{\columnwidth}&#10;</xsl:text>
<xsl:text>\addtolength{\mytablewidth}{-</xsl:text>
<xsl:value-of select="$nbr-cols * 2"/>
<xsl:text>\tabcolsep}&#10;</xsl:text>
<xsl:if test='$bqr'>
<xsl:text>\addtolength{\mytablewidth}{-2cm}&#10;</xsl:text>
</xsl:if>
<xsl:value-of select="$table.caption.mpsupertabular" />
<xsl:apply-templates select="tgroup[1]" mode="mpsupertabular"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test='$bqr'>
<xsl:text>\begin{center}&#10;&#10;</xsl:text>
<xsl:text>\vskip 3ex&#10;</xsl:text>
<xsl:text>* *\\[-2mm]&#10;</xsl:text>
<xsl:text>*&#10;</xsl:text>
<xsl:text>\end{center}&#10;</xsl:text>
<xsl:text>\end{changemargin}&#10;</xsl:text>
<xsl:text>\begin{multicols}{2}&#10;</xsl:text>
</xsl:if>
<xsl:text>% End table definition&#10;</xsl:text>
<xsl:text>% ------------------------ &#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>

96
legi2pdf/xsl/template.xml Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tabellio - software suite for deliberative assemblies
- suite logicielle pour assemblées délibératives
- http://www.tabellio.org/
Copyright (C) 2006 Parlement de la Communauté française de Belgique
This file is part of Tabellio.
Tabellio is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Tabellio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<doc-template>
<first-page>
<top-part><![CDATA[\thispagestyle{empty}
\onecolumn
\begin{changemargin}{-0.9cm}{-0.6cm}
\fontfamily{phv}\fontseries{m}\selectfont
\noindent\large{\textbf{%no%}} (%sess%) --- N\textsuperscript{o}%nodoc%\hfill\large{\textbf{%no%}} (%sess%) --- N\textsuperscript{o}%nodoc%\\[-0.3cm]
\rule{17.5cm}{0.04cm}
\normalfont
\begin{minipage}[b][7.6cm][c]{17.5cm}
\begin{center}
\vfill
\vfill
\textbf{
\Huge\textmd{{PARLEMENT}} \\
\vfill
\LARGE\textmd{{DE LA}} \\
\vfill
\Huge\textmd{{COMMUNAUT\'{E} FRAN\c{C}AISE}} \\
\vfill
\vfill
\fontfamily{phv}\fontseries{m}\selectfont
\Large\textmd{{Session %docsess%}}}
\normalfont
\vfill
\vfill
\end{center}
\end{minipage}
\begin{minipage}[b][0.8cm][s]{17.5cm}
\rule{17.5cm}{0.04cm}
\fontfamily{phv}\fontseries{m}\selectfont
\center\uppercase{{%date%}}\\[-0.3cm]
\normalfont
\rule{17.5cm}{0.04cm}
\end{minipage}
\vfill
]]></top-part>
<title-part><![CDATA[\begin{center}\parbox[b][][c]{12cm}{
\begin{center}
\fontfamily{phv}\fontseries{m}\selectfont
\LARGE\uppercase{{%__title__%}} \\[0.5cm]
\fontfamily{phv}\fontseries{m}\fontsize{12}{20}\selectfont\uppercase{{%__subtitle__%}}\\
\rule{1.2cm}{1pt}
\end{center}
}\end{center}
]]></title-part>
<title-part-with-footnote><![CDATA[\begin{center}\parbox[b][][c]{12cm}{
\begin{center}
\fontfamily{phv}\fontseries{m}\selectfont
\LARGE\uppercase{{%__title__%}} \\[0.5cm]
\fontfamily{phv}\fontseries{m}\fontsize{12}{20}\selectfont\uppercase{{%__subtitle__%\footnotemark[1]}}\\
\rule{1.2cm}{1pt}
\end{center}
}\end{center}
\footnotetext[1]{%__footnote__%}
]]></title-part-with-footnote>
<title-part-with-authors><![CDATA[\begin{center}\parbox[b][][c]{12cm}{
\begin{center}
\fontfamily{phv}\fontseries{m}\selectfont
\LARGE\uppercase{{%__title__%}} \\[0.5cm]
\fontfamily{phv}\fontseries{m}\fontsize{12}{20}\selectfont\uppercase{{%__subtitle__%}}\\
\fontfamily{phv}\fontseries{m}\fontsize{12}{20}\selectfont\uppercase{{PAR \textbf{%__authors__%}}}\\
\rule{1.2cm}{1pt}
\end{center}
}\end{center}]]></title-part-with-authors>
<bottom-part><![CDATA[\vfill
\end{changemargin}
\onecolumn
\tableofcontents
\twocolumn
]]></bottom-part>
</first-page>
</doc-template>