Commit 476e6098 authored by Anne Goloubkoff-Duponchel's avatar Anne Goloubkoff-Duponchel
Browse files

date et url

parent c7be5f9b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ function max.plugins.ead2pdf:fragmentToPDF($project, $routeDoc, $id){
            <archdesc>{max.api:getXMLByID($dbPath, $id)}</archdesc>
        </ead>
    (: return $content :)
    let $pdf := max.util:xml2pdf($content, max.util:getProjectFoXsl($project), $project)
    let $pdf := max.util:xml2pdf($content, max.util:getProjectFoXsl($project), $project,$id)
    return
        (<rest:response>
            <http:response status="200">
+3 −2
Original line number Diff line number Diff line
@@ -77,9 +77,10 @@ declare function max.util:addHTMLClass($htmlNode as node(), $targetId as xs:stri


(:xml 2 fo 2 pdf:)
declare function max.util:xml2pdf($xml as element(), $xsl as xs:string, $project as xs:string){
declare function max.util:xml2pdf($xml as element(), $xsl as xs:string, $project as xs:string, $id){
let $projectPrettyName := max.config:getProjectPrettyName($project)
let $xsl := xslt:transform($xml, $xsl, map{ "prettyName":$projectPrettyName})
let $baseURI:= max.config:getBaseURI()
let $xsl := xslt:transform($xml, $xsl, map{ "prettyName":$projectPrettyName,"idProject":$id})
let $pdf := fop:transform($xsl)
return $pdf
(: return file:write-binary('fop.pdf', $pdf):)
+67 −30
Original line number Diff line number Diff line
@@ -14,9 +14,7 @@

  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:param name="prettyName"/>
  <xsl:param name="baseuri"/>
  <xsl:param name="project"/>
  <xsl:param name="docName"/>
  <xsl:param name="idProject"/>

  <xsl:template match="ead:eadheader"/>
  <xsl:template match="ead:frontmatter"/>
@@ -36,20 +34,21 @@
        <!-- Les gabarits de page. Au moins 1 simple-page-master obligatoire-->
        <fo:simple-page-master master-name="eadheader" margin-top="40mm" margin-bottom="10mm" margin-left="20mm" margin-right="40mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-after extent="1cm" region-name="pied-premiere"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="premiere" margin-top="10mm" margin-bottom="10mm" margin-left="20mm" margin-right="20mm">
        <fo:simple-page-master master-name="premiere" margin-top="10mm" margin-bottom="10mm" margin-left="25mm" margin-right="25mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-after extent="1cm" region-name="pied-premiere"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="impaire" margin-top="10mm" margin-bottom="10mm" margin-left="20mm" margin-right="20mm">
        <fo:simple-page-master master-name="impaire" margin-top="10mm" margin-bottom="5mm" margin-left="25mm" margin-right="25mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-before extent="1cm" region-name="entete-impaire"/>
          <fo:region-after extent="1cm" region-name="pied-impaire"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="paire" margin-top="10mm" margin-bottom="10mm" margin-left="20mm" margin-right="20mm">
        <fo:simple-page-master master-name="paire" margin-top="10mm" margin-bottom="5mm" margin-left="25mm" margin-right="25mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-before extent="1cm" region-name="entete-paire"/>
          <fo:region-after extent="1cm" region-name="pied-paire"/>
@@ -67,6 +66,12 @@

      <!-- La première page contenant les métadonnées du eadheader, la séquence de page utilise le modèle "eadheader" décrit plus haut -->
      <fo:page-sequence master-reference="eadheader">
      <fo:static-content flow-name="pied-premiere">
          <fo:block text-align="left" font-size="9pt" space-after="6pt">
            <xsl:value-of select="../ead:eadheader/ead:filedesc/ead:publicationstmt/ead:publisher"/>
            <xsl:value-of select="format-dateTime(current-dateTime(),'[D,2]/[M,2]/[Y]')" />
          </fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
          <fo:block text-align="center" font-size="14pt" font-style="italic" space-after="16pt">
            <xsl:value-of select="$pretty-name"/>
@@ -80,10 +85,9 @@
          <fo:block text-align="left" font-size="10pt" space-after="6pt">
         Commanditaire : <xsl:value-of select="../ead:eadheader/ead:filedesc/ead:titlestmt/ead:sponsor"/>
          </fo:block>
          <fo:block text-align="left" font-size="10pt" space-after="6pt">
            <xsl:value-of select="../ead:eadheader/ead:filedesc/ead:publicationstmt/ead:publisher"/>
          </fo:block>
          
        </fo:flow>
        
      </fo:page-sequence>

      <!-- Début du document, la séquence de page utilise le modèle "corps" décrit plus haut -->
@@ -100,9 +104,24 @@
          </xsl:call-template>
        </fo:static-content>
        <fo:static-content flow-name="pied-impaire">
          <fo:block text-align="center" font-family="Times" font-size="8pt">
           <fo:table>
            <fo:table-body>
              <fo:table-row>
                <fo:table-cell>
                  <fo:block text-align="left" font-family="Times" font-size="7pt">
                    <xsl:value-of select="$idProject" /><xsl:text></xsl:text>
                    <xsl:value-of select="format-dateTime(current-dateTime(),'[D,2]/[M,2]/[Y]')" />
                  </fo:block>
                </fo:table-cell>
                <!-- <fo:inline text-align="right" font-family="Times" font-size="8pt"> -->
                <fo:table-cell>
                  <fo:block text-align="right" font-family="Times" font-size="8pt">
                   <fo:page-number/>
                  </fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-body>
          </fo:table>
        </fo:static-content>
        <fo:static-content flow-name="entete-paire">
          <xsl:call-template name="output-header">
@@ -110,9 +129,25 @@
          </xsl:call-template>
        </fo:static-content>
        <fo:static-content flow-name="pied-paire">
          <fo:block text-align="center" font-family="Times" font-size="8pt">
            <fo:page-number/>
          <fo:table>
            <fo:table-body>
              <fo:table-row>
                <fo:table-cell>
                  <fo:block text-align="left" font-family="Times" font-size="8pt">
                    <!-- <fo:page-number/> -->
                    Page <fo:page-number/>
                    <!-- <page-number-citation ref-id="last-page"/> -->
                  </fo:block>
                </fo:table-cell>
                <!-- <fo:inline text-align="right" font-family="Times" font-size="8pt"> -->
                <fo:table-cell>
                  <fo:block text-align="right" font-family="Times" font-size="7pt">
                    <xsl:value-of select="$idProject" /><xsl:text></xsl:text><xsl:value-of select="format-dateTime(current-dateTime(),'[D,2]/[M,2]/[Y]')" />
                  </fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-body>
          </fo:table>
        </fo:static-content>
        <fo:static-content flow-name="xsl-footnote-separator">
          <fo:block>
@@ -125,6 +160,8 @@
          <fo:block>
            <xsl:apply-templates />
          </fo:block>
          <!-- On insère ici un marqueur afin de connaître le nombre total de pages -->
					<block id="last-page"/>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>