Mercurial > hg > mpdl-group
view software/eXist/webapp/mpdl/_stuff/testDev/echo-figures.xql @ 7:5589d865af7a
Erstellung XQL/XSL Applikation
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 08 Feb 2011 15:16:46 +0100 |
parents | |
children |
line wrap: on
line source
xquery version "1.0"; declare namespace xlink="http://www.w3.org/1999/xlink"; declare namespace echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/"; declare namespace exist="http://exist.sourceforge.net/NS/exist"; declare namespace util = "http://exist-db.org/xquery/util"; import module namespace mpdl-text = "http://www.mpiwg-berlin.mpg.de/ns/mpdl/text" at "../..//text/all.xql"; let $coll := collection('/db/mpdl/documents/standard/echo') let $tmpResult := $coll//echo:figure let $result := for $figure at $pos in $tmpResult let $collName := util:collection-name($figure) let $shortCollName := substring-after(substring-after(substring-after(substring-after(substring-after($collName, "/"), "/"), "/"), "/"), "/") let $docName := util:document-name($figure) let $mpdlDocUri := concat("/", $shortCollName, "/", $docName) let $echoArchivePath := mpdl-text:getEchoArchivePath($mpdlDocUri) let $figLabel := string($figure/@xlink:label) let $imageFileName := string($figure/echo:image/@file) let $imageXlinkHref := string($figure/echo:image/@xlink:href) let $fullDocName := concat($collName, "/", $docName) let $document := doc($fullDocName) let $pageBreaks := $document//echo:pb let $pnOfFigure := count($pageBreaks[. << $figure]) let $captionStr := if (not(empty($figure/echo:caption))) then string-join($figure/echo:caption, " ") else "" let $descriptionStr := if (not(empty($figure/echo:description))) then string-join($figure/echo:description, " ") else "" let $captionElemStr := if ($captionStr != "") then concat("    <caption>", $captionStr, "</caption>") else "" let $descriptionElemStr := if ($descriptionStr != "") then concat("    <description>", $descriptionStr, "</description>") else "" let $caption := if ($captionElemStr != "") then <caption>{$captionElemStr}<br/></caption> else () let $description := if ($descriptionElemStr != "") then <description>{$descriptionElemStr}<br/></description> else () let $hit := <li> <a href="http://mpdl-dev.mpiwg-berlin.mpg.de/ECHOdocuView?url={$echoArchivePath}&pn={$pnOfFigure}&viewMode=images">{$mpdlDocUri}, Page {$pnOfFigure}</a> <br/>   <figure xlink:label="{$figLabel}"><br/>     <image file="{$imageFileName}" xlink:href="{$imageXlinkHref}"/> <br/> {$caption} {$description}   </figure> </li> order by $fullDocName, $pnOfFigure return $hit return <html> <body> <h2>All figures in all Echo documents</h2> <ol>{$result}</ol> </body> </html>