diff software/eXist/webapp/mpdl/_stuff/testDev/archimedes-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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/software/eXist/webapp/mpdl/_stuff/testDev/archimedes-figures.xql	Tue Feb 08 15:16:46 2011 +0100
@@ -0,0 +1,34 @@
+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";
+
+
+let $coll := collection('/db/mpdl/documents/standard/archimedes')
+let $tmpResult := $coll//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 $fullDocName := concat($collName, "/", $docName)
+    let $document := doc($fullDocName)
+    let $pageBreaks := $document//pb
+    let $pnOfFigure := count($pageBreaks[. << $figure])
+    let $hit := 
+      <li>
+        <a href="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/page-query-result.xql?document={$mpdlDocUri}&amp;pn={$pnOfFigure}&amp;mode=text">{$mpdlDocUri}, Page {$pnOfFigure}</a>
+      </li>
+  order by $fullDocName, $pnOfFigure
+  return $hit
+
+return 
+  <html>
+  <body>
+  <h2>All figures in all Archimedes documents</h2>
+  <ol>{$result}</ol>
+  </body>
+  </html>
\ No newline at end of file