diff software/eXist/webapp/mpdl/_stuff/oxygen-projects/monte-project/archimedes-image-fragment.xsl @ 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/oxygen-projects/monte-project/archimedes-image-fragment.xsl	Tue Feb 08 15:16:46 2011 +0100
@@ -0,0 +1,122 @@
+<xsl:stylesheet version="1.0" 
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<xsl:output method="html"/>
+
+<xsl:template match="result">
+  <html><body>
+    <xsl:variable name="ft-query-name" select="/result/ft-query/name"/>
+    <xsl:for-each select="document-description">
+      <h2>
+      <xsl:for-each select="info">
+        <xsl:value-of select="author"/>.
+        <xsl:value-of select="title"/>.
+        <xsl:value-of select="place"/>, 
+        <xsl:value-of select="date"/>
+      </xsl:for-each>
+      </h2>
+    </xsl:for-each>
+    <xsl:for-each select="page">
+      <xsl:variable name="documentName" select="/result/document-description/document-name"/>
+      <xsl:variable name="countPages" select="/result/document-description/count-pages"/>
+      <xsl:variable name="number" select="number"/>
+      <xsl:variable name="ftQueryName" select="/result/ft-query/name"/>
+      <xsl:variable name="documentValue" select="concat('document=', $documentName)"/>
+      <xsl:variable name="pnValue" select="concat('pn=', $number)"/>
+      <xsl:variable name="modeImageValue" select="concat('mode=', 'image')"/>
+      <xsl:variable name="modeXmlValue" select="concat('mode=', 'xml')"/>
+      <xsl:variable name="modeTextValue" select="concat('mode=', 'text')"/>
+      <xsl:variable name="ftQueryStr" select="concat('&amp;', 'ft-query=', $ftQueryName)"/>
+      <xsl:variable name="ftQueryValue">
+        <xsl:choose>
+          <xsl:when test="/result/ft-query[node()]"><xsl:value-of select="$ftQueryStr"/></xsl:when>
+          <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="imageLink" select="concat($documentValue, '&amp;', $pnValue, '&amp;', $modeImageValue, $ftQueryValue)"/>
+      <xsl:variable name="textLink" select="concat($documentValue, '&amp;', $pnValue, '&amp;', $modeTextValue, $ftQueryValue)"/>
+      <xsl:variable name="xmlLink" select="concat($documentValue, '&amp;', $pnValue, '&amp;', $modeXmlValue, $ftQueryValue)"/>
+      <form action="" method="get"></form>
+      <table width="100%">
+        <colgroup>
+          <col width="30%"/>
+          <col width="70%"/>
+        </colgroup>
+        <tr>
+        <td align="left" nowrap="true">
+          [<a href="?{$textLink}">Text</a>] 
+          [Image] 
+          [<a href="?{$xmlLink}">XML</a>] 
+        </td>
+        <td nowrap="true">
+          <td align="right">
+            <xsl:choose>
+              <xsl:when test="$number &gt; 1">
+                <a href="?{$documentValue}&amp;pn={$number - 1}&amp;{$modeImageValue}{$ftQueryValue}"><img src="images/left.gif" alt="page-down" border="0"/></a>
+              </xsl:when>
+              <xsl:otherwise>
+                <a href="?{$imageLink}"><img src="images/left.gif" alt="page-down" border="0"/></a>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <td nowrap="true">
+            <xsl:value-of select="$number"/> / <xsl:value-of select="$countPages"/> 
+          </td>
+          <td>
+            <xsl:choose>
+              <xsl:when test="$number &lt; $countPages">
+                <a href="?{$documentValue}&amp;pn={$number + 1}&amp;{$modeImageValue}{$ftQueryValue}"><img src="images/right.gif" alt="page-up" border="0"/></a>
+              </xsl:when>
+              <xsl:otherwise>
+                <a href="?{$imageLink}"><img src="images/right.gif" alt="page-down" border="0"/></a>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <td nowrap="true">
+            <input type="hidden" name="document" value="{$documentName}"/>
+            Page: <input type="text" size="3" name="pn" value="{$number}"/>
+            <input type="hidden" name="mode" value="image"/>
+          </td>
+        </td>
+        </tr>
+      </table>
+      <hr/>   
+      <xsl:variable name="linkImageEcho" select="/result/page/image-echo"/>
+      <xsl:variable name="linkImageScaler" select="/result/page/image-scaler"/>
+      <table align="middle" width="100%">
+        <colgroup>
+          <col width="10%"/>
+          <col width="60%"/>
+          <col width="30%"/>
+        </colgroup>
+        <tr>
+          <td/>
+          <td align="left" valign="top">
+            <a href="{$linkImageEcho}"><img alt="Page image: {$number}" src="{$linkImageScaler}&amp;dh=600" border="1"/></a>
+          </td>
+          <xsl:if test="$ftQueryValue!=''">
+          <td align="left" valign="top">
+            <b><xsl:value-of select="/result/ft-query/result/size"/> Hits: "<xsl:value-of select="$ftQueryName"/>"</b>
+            <ol>
+              <xsl:for-each select="/result/ft-query/result/hits/hit">
+              <li>
+                <xsl:variable name="hitPN" select="pn"/>
+                <xsl:variable name="hitPosOfS" select="pos-of-s"/>
+                <a href="?{$documentValue}&amp;pn={$hitPN}&amp;{$modeImageValue}{$ftQueryValue}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPosOfS"/></a>
+              </li>
+              </xsl:for-each>
+            </ol>
+          </td>
+          </xsl:if>
+        </tr>
+      </table>
+    </xsl:for-each>
+    <hr/>
+    <xsl:for-each select="document-description">
+      Elapsed time: <xsl:value-of select="performance"/> ms, Back to <a href="query.xql">query page</a>, see the <a href="page-query-result.xql?_source=yes">XQuery source</a> and <a href="/exist/rest/db/xsl/archimedes-image-fragment.xsl?_source=yes">XSL source</a> of this page
+    </xsl:for-each>    
+  </body></html>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file