source: gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl@ 36997

Last change on this file since 36997 was 36997, checked in by davidb, 12 months ago

Collection now developed to the point where Google Vision OCR bounding boxes are displayed over the screen-size image for a simple doc

File size: 5.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util gsf">
10
11
12 <xsl:template name="iiif-links">
13 <xsl:param name="identifier"/>
14
15 <div style="padding-top: 10px; padding-bottom: 10px;">
16 IIIF Server Info URL:
17 <a href="/gs-cantaloupe/iiif/2/{$site_name}:{$collNameChecked}:{$identifier}/info.json">
18 /gs-cantaloupe/iiif/2/<xsl:value-of select="$site_name"/>:<xsl:value-of select="$collNameChecked"/>:<xsl:value-of select="$identifier"/>/info.json
19 </a>
20 </div>
21
22 <div style="padding-top: 10px; padding-bottom: 10px;">
23 IIIF Server Image URL:
24 <a href="/gs-cantaloupe/iiif/2/{$site_name}:{$collNameChecked}:{$identifier}/full/full/0/default.jpg">
25 /gs-cantaloupe/iiif/2/<xsl:value-of select="$site_name"/>:<xsl:value-of select="$collNameChecked"/>:<xsl:value-of select="$identifier"/>/full/full/0/default.jpg
26 </a> <br />
27 </div>
28
29 </xsl:template>
30
31
32 <xsl:template name="googlevision-ocr-json">
33 <xsl:param name="assocfilepath"/>
34
35 <div style="padding-top: 10px; padding-bottom: 10px;">
36 Google Vision OCR JSON:
37 <a>
38 <xsl:attribute name="href">
39 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
40 <xsl:text>/index/assoc/</xsl:text><xsl:value-of disable-output-escaping="yes" select="$assocfilepath" /><xsl:text>/</xsl:text>enable_document_ocrgoogle-vision-output.json
41 </xsl:attribute>
42 enable_document_ocrgoogle-vision-output.json
43 </a>
44 </div>
45 <gsf:script>
46 load_gv_dococr_json("enable_document_ocrgoogle-vision-output.json",display_gv_ocr_bounding_boxes);
47 </gsf:script>
48 </xsl:template>
49
50<!--
51 <xsl:template name="sectionPre">
52 OCR'd Text:
53 </xsl:template>
54
55 <xsl:template name="documentPre">
56 OCR'd Text:
57 </xsl:template>
58-->
59
60 <xsl:template name="sectionPost">
61 <!-- add in IIIF Server link for section image -->
62 <xsl:variable name="nodeID" select="@nodeID"/>
63 <xsl:call-template name="iiif-links">
64 <xsl:with-param name="identifier" select="$nodeID" />
65 </xsl:call-template>
66 <!-- add in Google Vision OCR JSON link for section image -->
67 <xsl:call-template name="googlevision-ocr-json">
68 <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" select="root"/></xsl:with-param>
69 </xsl:call-template>
70 </xsl:template>
71
72 <xsl:template name="documentPre">
73 <xsl:variable name="httpCollection">library/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:variable>
74 <gsf:script src="{$httpCollection}/js/document_viewer.js"/>
75 <style>
76 div.ocr-boundingbox-overlay {
77 position: absolute;
78 left: 0;
79 top: 0;
80 }
81
82 div.ocr-boundingbox {
83 position: absolute;
84 border: solid black 1px;
85 }
86
87 </style>
88 </xsl:template>
89
90 <xsl:template name="documentPost">
91 <!-- add in IIIF Server link for simple page image -->
92 <xsl:if test="@docType='simple'">
93 <xsl:call-template name="iiif-links">
94 <xsl:with-param name="identifier" select="$docID" />
95 </xsl:call-template>
96 <!-- add in Google Vision OCR JSON link for simple page image -->
97 <xsl:call-template name="googlevision-ocr-json">
98 <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
99 </xsl:call-template>
100 </xsl:if>
101 </xsl:template>
102
103
104 <!-- content of a simple document. Will not be used for editing mode -->
105 <xsl:template name="documentPostInProgress">
106
107
108 <!--
109 canDoEditing = <xsl:value-of select="$canDoEditing"/> <br />
110 editingTurnedOn = <xsl:value-of select="$editingTurnedOn"/>
111 -->
112
113 <!--
114
115 <xsl:choose>
116 <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true'">
117
118 <xsl:when test="$canDoEditing = 'true'">
119-->
120 <gsf:script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"/>
121
122
123 <!-- By default uses Roboto font. Be sure to load this or change the font -->
124 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
125 <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->
126
127 <div style="position: relative; width: 100%; height: 800px;">
128 <div id="my-mirador"> <xsl:comment>filler</xsl:comment></div>
129 </div>
130
131 <gsf:script>
132
133var mirador = Mirador.viewer({
134 "id": "my-mirador",
135 "manifests": {
136 "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": {
137 "provider": "IntermusE"
138 }
139 },
140 "window" : { "panels" : { "annotations": true, "attribution": false } },
141 "annotations": {
142 "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values
143 "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'],
144 },
145 "windows": [
146 {
147 "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
148 "canvasIndex": 2,
149 "thumbnailNavigationPosition": 'far-bottom'
150 }
151 ]
152});
153 </gsf:script>
154
155 <!--
156 </xsl:when>
157 </xsl:choose>
158-->
159
160 </xsl:template>
161
162
163</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.