diff --git a/src/main/bundles/max-dumb-xml/dumb-xml/dumb-xml.xqm b/src/main/bundles/max-dumb-xml/dumb-xml/dumb-xml.xqm
index 9b436b15c42012d6c5a80369dab3312e4ff9484c..fae70bbda281b00740708999c4f3daa13f252ba1 100644
--- a/src/main/bundles/max-dumb-xml/dumb-xml/dumb-xml.xqm
+++ b/src/main/bundles/max-dumb-xml/dumb-xml/dumb-xml.xqm
@@ -10,21 +10,26 @@ import module namespace i18n = "https://certic.unicaen.fr/max/i18n" at '../../..
 import module namespace database = "https://certic.unicaen.fr/max/database" at '../../../core/database.xqm';
 import module namespace errors = "https://certic.unicaen.fr/max/errors" at '../../../core/errors.xqm';
 
-declare function dumb-xml:doc-to-html($document as document-node(), $lang as xs:string){
-    (:generate random http link to an identified node in $document:)
-    let $identifiers:= $document//*/@xml:id/string()
-    let $n := count($identifiers)
-    let $r := random:integer($n) + 1
-    let $target := $identifiers[$r]
-    let $href := fn:replace(request:path(),'.html', '') || '/id/' || $target || '.html'
+declare function dumb-xml:doc-to-html($document as document-node(), $lang as xs:string) as element(html){
+    let $customXQ := file:current-dir()|| '/xq/document.xq'
+    let $content := if(file:exists($customXQ)) 
+                    then xquery:eval(xs:anyURI($customXQ), map {'doc': $document, 'lang': $lang})
+                    else 
+                        (:generate random http link to an identified node in $document:)
+                        let $identifiers:= $document//*/@xml:id/string()
+                        let $n := count($identifiers)
+                        let $r := random:integer($n) + 1
+                        let $target := $identifiers[$r]
+                        let $href := fn:replace(request:path(),'.html', '') || '/id/' || $target || '.html'
+                        return
+                            <div>
+                            <h2>{i18n:translate('raw', $lang)} | {fn:replace(fn:base-uri($document), '/' || $database:max-db || '/', '')}</h2>
+                                {$document}
+                                <nav>
+                                    <h3><a href="{$href}">{i18n:translate('random-link', $lang)} ({$target})</a></h3>
+                                </nav>
+                            </div>
 
-    let $content := <div>
-                        <h2>{i18n:translate('raw', $lang)} | {fn:replace(fn:base-uri($document), '/' || $database:max-db || '/', '')}</h2>
-                        {$document}
-                        <nav>
-                            <h3><a href="{$href}">{i18n:translate('random-link', $lang)} ({$target})</a></h3>
-                        </nav>
-                    </div>
     return templating:render('page.html', map {'content': $content, 'lang': $lang})
 };