Loading plugins/index/index.xqm +26 −11 Changes for plugins/index/index.xqm: 26 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -15,7 +15,19 @@ declare %output:method("html") %rest:path("/{$project}/index") function max.plugin.index:index($project){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index.frag.html' return if(file:exists($indexFilePath)) then let $content := <div id='content'>{doc($indexFilePath)}</div> return max.html:render($project, 'index', $content) else max.plugin.index:generateIndex($project) }; declare function max.plugin.index:generateIndex($project){ let $dbPath := max.config:getProjectDBPath($project) let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index.frag.html' let $idxGenreform := <index type="Type de documents">{for $idx in collection($dbPath)//*:controlaccess/*:genreform let $cId := $idx/ancestor::*:c[1]/@id Loading @@ -24,17 +36,20 @@ let $idxGenreform := <index type="Type de documents">{for $idx in collection($db let $result := <marker id="{$cId}" otherlevel="{$cOtherlevel}"><entry>{$cUnitid}</entry><value>{$idx/text()}</value></marker> return $result}</index> let $idxPerson := <index type="Personnes">{for $idx in collection($dbPath)//*:persname let $cId := $idx/ancestor::*:c[1]/@id let $cOtherlevel := $idx/ancestor::*:c[1]/@otherlevel let $role := $idx/@role let $cUnitid := $idx/ancestor::*:c[1]/descendant::*:unitid[1]/text() let $result := <marker id="{$cId}" otherlevel="{$cOtherlevel}" role="{$role}"><entry>{$cUnitid}</entry><value>{data($idx/@normal)}</value></marker> return $result}</index> let $idx := <idx>{$idxGenreform}{max.plugin.index:loadIndex($project)}</idx> let $idx := <idx>{$idxGenreform}{$idxPerson}</idx> let $HTMLIndex := xslt:transform($idx, 'indexing.xsl', ()) return max.html:render($project, 'index', <div class='index'>{$HTMLIndex}</div>) let $indexCore := xslt:transform($idx, 'indexing.xsl', ()) let $projectXSLIndex := file:parent(file:parent(file:parent(static-base-uri())))||'/editions/'||$project||'/ui/xsl/indexing.xsl' let $HTMLIndex := if (file:exists($projectXSLIndex)) then xslt:transform($indexCore, $projectXSLIndex, ()) else $indexCore (: return max.html:render($project, 'index', <div class='index'>{$HTMLIndex}</div>) :) return file:write($indexFilePath, <div class='index'>{$HTMLIndex}</div>), max.plugin.index:index($project) }; declare function max.plugin.index:loadIndex($edition) { let $projectIndex := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$edition||"/xq/index.xq" return if (file:exists($projectIndex)) then xquery:eval(xs:anyURI($projectIndex)) else() }; No newline at end of file plugins/index/indexing.xsl +3 −0 Changes for plugins/index/indexing.xsl: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -61,4 +61,7 @@ </div> </xsl:template> <xsl:template match="index"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> No newline at end of file Loading
plugins/index/index.xqm +26 −11 Changes for plugins/index/index.xqm: 26 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -15,7 +15,19 @@ declare %output:method("html") %rest:path("/{$project}/index") function max.plugin.index:index($project){ let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index.frag.html' return if(file:exists($indexFilePath)) then let $content := <div id='content'>{doc($indexFilePath)}</div> return max.html:render($project, 'index', $content) else max.plugin.index:generateIndex($project) }; declare function max.plugin.index:generateIndex($project){ let $dbPath := max.config:getProjectDBPath($project) let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index.frag.html' let $idxGenreform := <index type="Type de documents">{for $idx in collection($dbPath)//*:controlaccess/*:genreform let $cId := $idx/ancestor::*:c[1]/@id Loading @@ -24,17 +36,20 @@ let $idxGenreform := <index type="Type de documents">{for $idx in collection($db let $result := <marker id="{$cId}" otherlevel="{$cOtherlevel}"><entry>{$cUnitid}</entry><value>{$idx/text()}</value></marker> return $result}</index> let $idxPerson := <index type="Personnes">{for $idx in collection($dbPath)//*:persname let $cId := $idx/ancestor::*:c[1]/@id let $cOtherlevel := $idx/ancestor::*:c[1]/@otherlevel let $role := $idx/@role let $cUnitid := $idx/ancestor::*:c[1]/descendant::*:unitid[1]/text() let $result := <marker id="{$cId}" otherlevel="{$cOtherlevel}" role="{$role}"><entry>{$cUnitid}</entry><value>{data($idx/@normal)}</value></marker> return $result}</index> let $idx := <idx>{$idxGenreform}{max.plugin.index:loadIndex($project)}</idx> let $idx := <idx>{$idxGenreform}{$idxPerson}</idx> let $HTMLIndex := xslt:transform($idx, 'indexing.xsl', ()) return max.html:render($project, 'index', <div class='index'>{$HTMLIndex}</div>) let $indexCore := xslt:transform($idx, 'indexing.xsl', ()) let $projectXSLIndex := file:parent(file:parent(file:parent(static-base-uri())))||'/editions/'||$project||'/ui/xsl/indexing.xsl' let $HTMLIndex := if (file:exists($projectXSLIndex)) then xslt:transform($indexCore, $projectXSLIndex, ()) else $indexCore (: return max.html:render($project, 'index', <div class='index'>{$HTMLIndex}</div>) :) return file:write($indexFilePath, <div class='index'>{$HTMLIndex}</div>), max.plugin.index:index($project) }; declare function max.plugin.index:loadIndex($edition) { let $projectIndex := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$edition||"/xq/index.xq" return if (file:exists($projectIndex)) then xquery:eval(xs:anyURI($projectIndex)) else() }; No newline at end of file
plugins/index/indexing.xsl +3 −0 Changes for plugins/index/indexing.xsl: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -61,4 +61,7 @@ </div> </xsl:template> <xsl:template match="index"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> No newline at end of file