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

ajout fichier manquant (ead > document_doc.xq)

parent ee47ca38
Loading
Loading
Loading
Loading
+69
Changes for rxq/ead/document_toc.xq: 69 added lines, 0 removed lines.
Original line number Diff line number Diff line
import module namespace max.config = 'pddn/max/config' at '../config.xqm';


declare variable $baseURI external;
declare variable $project external;
declare variable $doc external;


declare function local:buildEADDocumentTOC($projectId, $docPath){
    let $dbPath := concat(max.config:getProjectDBPath($projectId), "/", $docPath)
    let $target := doc($dbPath)

    return
        <nav>
            {
                for $c in $target/*:ead/*:archdesc
                return
                    <details id="details_{$c/@id}">
                        <summary>
                            {$c/@id}
                            {$c/*:did/*:unittitle[1]//text()}
                        </summary>
                        {local:getComponentChildren($c, $projectId, $docPath)}
                    </details>
            }
        </nav>
};

declare function local:hasComponentChildren($component){
    0
};

declare function local:getComponentChildren($component, $projectId, $docPath){
    for $c in $component/*:dsc/*:c
    return
        <details  id="details_{$c/@id}">
            <summary>
                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}">
                    {$c/@id}
                    {$c/*:did/*:unitid[1]//text()}
                    –
                    {$c/*:did/*:unittitle[1]//text()}
                </a>
            </summary>
            {local:getComponentGrandChildren($c, $projectId, $docPath)}
        </details>
};

declare function local:hasComponentGrandChildren($component){
    0
};

declare function local:getComponentGrandChildren($component, $projectId, $docPath){
    for $c in $component/*:c
    return
        <details  id="details_{$c/@id}">
            <summary>
                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}">
                    {$c/@id}
                    {$c/*:did/*:unitid[1]//text()}
                    –
                    {$c/*:did/*:unittitle[1]//text()}
                </a>
            </summary>
            {local:getComponentGrandChildren($c, $projectId, $docPath)}
        </details>
};

local:buildEADDocumentTOC($project, $doc)