Index: gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl
===================================================================
--- gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl	(revision 37088)
+++ gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl	(revision 37105)
@@ -84,5 +84,5 @@
 
 
-  <xsl:template name="googlevision-ocr-json">
+  <xsl:template name="opt-googlevision-ocr-json">
     <xsl:param name="assocfilepath"/>
     
@@ -90,19 +90,15 @@
     <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')"/></gsf:variable>
 
-    <!--
-    <div style="padding-top: 10px; padding-bottom: 10px;">
-      Google Vision OCR JSON:
-      <a>
-	<xsl:attribute name="href">
-	  <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
-	  <xsl:text>/index/assoc/</xsl:text><xsl:value-of disable-output-escaping="yes" select="$assocfilepath" /><xsl:text>/</xsl:text><xsl:value-of select="$GVDocumentOCRJSON"/>
-	</xsl:attribute>
-	<xsl:value-of select="$GVDocumentOCRJSON"/>
-      </a>
-    </div>
-    -->
-    <gsf:script>
-      load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
-    </gsf:script>
+    <gsf:switch>
+      <gsf:metadata name="HasGoogleVisionDocumentOCRJSON"/>
+      <gsf:when test='equals' test-value="1">
+
+	<gsf:script>
+	  // Load in the Google Vision OCR JSON file and display bounding boxes for this document (docType=simple) or page (docType=paged)
+	  load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
+	</gsf:script>
+      </gsf:when>
+    </gsf:switch>
+    
   </xsl:template>
 
@@ -117,5 +113,5 @@
 
     <!-- add in Google Vision OCR JSON link for section image -->
-    <xsl:call-template name="googlevision-ocr-json">
+    <xsl:call-template name="opt-googlevision-ocr-json">
       <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" select="root"/></xsl:with-param>
     </xsl:call-template>    
@@ -177,4 +173,16 @@
   <xsl:template name="documentPre">
     <xsl:variable name="httpCollection">library/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:variable>
+
+    <gsf:variable name="optionIncludeFileAssocOpenAnnotations">
+      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeFileAssocOpenAnnotations']/@value"/>
+    </gsf:variable>
+    <gsf:variable name="optionIncludeEditableOpenAnnotations">
+      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@value"/>
+    </gsf:variable>
+    <gsf:variable name="optionIncludeEditableOpenAnnotationsEndpointURL">
+      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@endpointURL"/>
+    </gsf:variable>
+
+
     <gsf:variable name="chosenTitle"><xsl:call-template name="choose-title"/></gsf:variable>
     <!-- <gsf:variable name="toplevelTitle"><gsf:metadata name="Title" select="root"/></gsf:variable> -->
@@ -259,20 +267,7 @@
     
     <xsl:if test="@docType='simple'">
-
-      <!--
-      <gsf:switch>
-	<gsf:metadata name='HasGoogleVisionDocumentOCRJSON";'/>
-      <gsf:when test='equals' test-value="1">
-      -->
-
-	  <!-- add in Google Vision OCR JSON link for simple page image -->      
-	  <xsl:call-template name="googlevision-ocr-json">
-	    <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
-	  </xsl:call-template>
-	  <!--
-	</gsf:when>
-      </gsf:switch>
--->
-      
+      <xsl:call-template name="opt-googlevision-ocr-json">
+	<xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
+      </xsl:call-template>      
     </xsl:if>
   </xsl:template>
@@ -282,6 +277,24 @@
     <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->    
     <div style="position: relative; width: 100%; height: 800px;">
-      <div id="mirador3-viewer"> <xsl:comment>filler</xsl:comment></div>
-    </div>
+      <div id="mirador3-viewer"><xsl:comment>filler</xsl:comment></div>
+    </div>
+
+    <!--
+    <gsf:variable name="endpointURL">
+      <xsl:choose>
+	<xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@value='true'">
+	  <xsl:choose>
+	    <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@endpointURL">
+	      <xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='includeEditableOpenAnnotations']/@endpointURL"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>localStorage</xsl:text> < ! - - default - - >
+	    </xsl:otherwise>
+	  </xsl:choose>
+        </xsl:when>
+	<xsl:otherwise></xsl:otherwise>
+      </xsl:choose>
+    </gsf:variable>
+    -->
 
     <gsf:script>      
