IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

[XSL-FO] problème avec fo:root


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Février 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 16
    Points : 5
    Points
    5
    Par défaut [XSL-FO] problème avec fo:root
    Bonjour,

    J'essaye de faire tourner une petite xsl/fo sous oXygen et Apache FOP, mais ça bloque sur une erreur 1 qui dit "First element must be the fo:root element formatting objet. Found fo:block instead".

    J'ai épluché le programme dans tous les sens mais je vois pas le problème.

    Si quelqu'un peut me dépanner, voici le programme :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
     
     
    <?xml version="1.0" encoding="UTF-8" ?>
     
    <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format">
     
        <xsl:template match="livre">
            <xsl:processing-instruction name="140205">Phebus:140x205</xsl:processing-instruction>
            <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
                <fo:layout-master-set>
     
                    <fo:simple-page-master master-name="first" 
                        page-height="20.5cm" 
                        page-width="14cm"
                        margin-top="3.18cm" 
                        margin-bottom="3.6742cm" 
                        margin-left="2.5cm"
                        margin-right="3cm">
                        <fo:region-body margin-top="3.18cm" margin-bottom="3.6742cm" margin-left="2.5cm"
                            margin-right="3cm"/>
     
                        <fo:region-before extent="3.18cm"/>
                        <fo:region-after extent="3.6742cm"/>
                    </fo:simple-page-master>
     
                    <fo:simple-page-master master-name="right" page-height="20.5cm" page-width="14cm"
                        margin-top="1.5cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
                        <fo:region-body margin-top="2cm"/>
                        <fo:region-before extent="2.5cm"/>
                        <fo:region-after extent="1.5cm"/>
                    </fo:simple-page-master>
     
                    <fo:simple-page-master master-name="left" page-height="20.5cm" page-width="14cm"
                        margin-top="1.5cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
                        <fo:region-body margin-top="2cm"/>
                        <fo:region-before extent="2.5cm"/>
                        <fo:region-after extent="1.5cm"/>
                    </fo:simple-page-master>
     
                    <fo:page-sequence-master master-name="run">
                        <fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
                            <fo:conditional-page-master-reference master-reference="left"
                                odd-or-even="even"/>
     
                            <fo:conditional-page-master-reference master-reference="right"
                                odd-or-even="odd"/>
                            <fo:conditional-page-master-reference master-reference="title"/>
                        </fo:repeatable-page-master-alternatives>
                    </fo:page-sequence-master>
     
                </fo:layout-master-set>
     
                <!-- end: defines page layout -->
     
                <!-- actual layout -->
     
                <!-- THIS CHANGED
       <fo:page-sequence master-name="run" initial-page-number="1">
       -->
                <fo:page-sequence master-reference="run" initial-page-number="1">
     
     
                    <fo:static-content flow-name="xsl-region-before">
                        <fo:block text-align="center" font-size="10pt" font-family="serif" font-variant="Small-caps"
                            line-height="11pt">Bifteck <fo:page-number position="end"/>
                        </fo:block>
                    </fo:static-content>
     
                    <fo:flow flow-name="xsl-region-body" font-size="10pt" line-height="11pt">
     
     
                        <fo:block color="red" font-size="30pt" line-height="32pt" text-align="center"
                            space-before.optimum="22pt">
                            <xsl:value-of select="/ident/auteur"/>
                        </fo:block>
     
                        <fo:block font-size="10pt" line-height="11pt" text-align="center"
                            space-before.optimum="14pt">
                            <xsl:value-of select="/ident/tit"/>
                        </fo:block>
                        <xsl:apply-templates/>
     
                    </fo:flow>
     
                </fo:page-sequence>
     
            </fo:root>
     
        </xsl:template>
     
     
     
        <!-- this is the real root of the program -->
     
        <xsl:template match="livre">
     
            <fo:block color="red" font-size="40pt" line-height="42pt" text-align="center"
                space-before.optimum="22pt">
                <xsl:value-of select="/ident/auteur"/>
            </fo:block>
     
            <fo:block font-size="11pt" line-height="12.76pt" text-align="justify" text-indent="4mm"
                space-before.optimum="14pt">
                <!-- apply templates one by one -->
                <xsl:apply-templates/>
     
            </fo:block>
     
        </xsl:template>
     
        <!-- ************************************************************ -->
        <!-- stuff in the beginning of the program -->
     
        <xsl:template match="/ident/edit">
            <xsl:apply-templates/>
        </xsl:template>
     
        <xsl:template match="/ident/ean">
     
            <fo:block font-size="12pt" line-height="12pt" text-align="center"
                space-before.optimum="12pt">Lieu: <xsl:value-of select="name"/>
                <!--
      <xsl:value-of select="address"/>
       -->
            </fo:block>
            <!--
     <fo:block space-before.optimum="12pt">
     <fo:external-graphic src="{local-logo}"
      content-height="27pt" content-width="100pt"
      />
     </fo:block>
      -->
        </xsl:template>
     
     
     
        <xsl:template match="n">
            <fo:block font-size="13pt" text-align="center" space-before.optimum="24pt">
                <xsl:apply-templates/>
            </fo:block>
        </xsl:template>
     
     
        <xsl:template match="p">
            <fo:block font-size="11pt" line-height="12.76pt" text-align="justify" text-indent="4mm">
             <xsl:apply-templates/>
            </fo:block>
        </xsl:template>
     
     
     
     
    </xsl:stylesheet>

  2. #2
    Rédacteur

    Avatar de Erwy
    Homme Profil pro
    Développeur Web
    Inscrit en
    Novembre 2003
    Messages
    4 967
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Novembre 2003
    Messages : 4 967
    Points : 10 927
    Points
    10 927
    Par défaut
    Pourquoi tu as deux templates avec match="livre" ?
    Seule la seconde sera prise en compte et en effet elle commence par un fo: block au lien d'un fo:root (comme la première)

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Février 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 16
    Points : 5
    Points
    5
    Par défaut probmème avec fo:root
    En effet, j'avais oublié de mettre

    <xsl:template match="livre_PUTBACK_MAYBE">

    dans le second.

    Merci de m'avoir mis sur la voie

Discussions similaires

  1. problèmes avec Ogre::Root
    Par hervinhio dans le forum Ogre
    Réponses: 3
    Dernier message: 06/03/2011, 23h23
  2. [XSL~FO] Problème avec une table de plus d'une page
    Par ganga dans le forum XSL/XSLT/XPATH
    Réponses: 4
    Dernier message: 25/01/2007, 20h16
  3. [XSL] problème avec copy espace de nom
    Par luta dans le forum XSL/XSLT/XPATH
    Réponses: 1
    Dernier message: 11/10/2005, 15h18
  4. [xsl:fo] problème avec external-graphic
    Par jehlg dans le forum XSL/XSLT/XPATH
    Réponses: 2
    Dernier message: 11/10/2005, 11h57
  5. [XSL]problème avec <xsl:when>
    Par Devil666 dans le forum XSL/XSLT/XPATH
    Réponses: 12
    Dernier message: 27/05/2005, 16h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo