Commit cb061465 authored by Jérôme Chauveau's avatar Jérôme Chauveau
Browse files

essai fop suite à la maj du module fop.jar par Christian :...

essai fop suite à la maj du module fop.jar par Christian : https://files.basex.org/modules/org/basex/modules/fop/
parent bc80141d
Loading
Loading
Loading
Loading
+17
Changes for max.xq: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -341,3 +341,20 @@ declare %private function max:invokePluginXQueries($project, $routeDoc, $id){
            else ()
    return $pluginsHTML
};


declare
%rest:GET
%rest:path("/{$projectId}/test/fop")
%rest:produces("application/pdf")
function max:testFOP($projectId){
    let $pdf := max.util:xml2pdf(<TEI><div>TEST PDF !</div></TEI>, max.util:getProjectFoXsl($projectId))
    return
        (<rest:response>
            <http:response status="200">
                <http:header name="content-type" value="application/pdf"/>
            </http:response>
        </rest:response>,
        $pdf)

};
 No newline at end of file
+3
Changes for rxq/cons.xqm: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ declare variable $max.cons:DOCUMENT_TITLE_XSL_FILEPATH := "document_title.xsl";
(: text xsl :)
declare variable $max.cons:TEXT_HOOK_XSL_FILEPATH := "text_hook.xsl";

(: document title xsl :)
declare variable $max.cons:FO_XSL_FILEPATH := "2fo.xsl";

(:Project TOC  types:)
declare variable $max.cons:AUTO_TOC := "auto";
declare variable $max.cons:CUSTOM_TOC := "custom";
+19
Changes for rxq/util.xqm: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ module namespace max.util = 'pddn/max/util';
declare namespace xsl = "http://www.w3.org/1999/XSL/Transform";
import module namespace max.config = 'pddn/max/config' at 'config.xqm';
import module namespace max.cons = 'pddn/max/cons' at 'cons.xqm';
import module namespace fop = 'org.basex.modules.fop.FOP';
declare namespace tei="http://www.tei-c.org/ns/1.0";

(:
@@ -45,6 +46,15 @@ declare function max.util:buildXSLTDoc($xsltMain as xs:string, $xsltAddons as xs
};


(:xml 2 fo 2 pdf:)

declare function max.util:xml2pdf($xml as element(), $xsl as xs:string){
let $xsl := xslt:transform($xml, $xsl)
 let $pdf := fop:transform($xsl)
return $pdf
(: return file:write-binary('fop.pdf', $pdf):)
};

(: XML DB Resources LISTING functions:)
(:
lists collection' sub collections 
@@ -217,6 +227,15 @@ declare function max.util:getNavigationBarXSL($projectId) {

};

(:
 Returns project's FO xsl
:)
declare function max.util:getProjectFoXsl($projectId) {

    let $xmlFormat:=max.config:getXMLFormat($projectId)
    return max.util:getResourceFilePath($projectId, "ui/xsl/" || $xmlFormat ||'/'|| $xmlFormat || $max.cons:FO_XSL_FILEPATH)
};

(:
 Returns project's doc toc XQuery File
:)