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 | <gsf:variable name="GVDocumentOCRJSON"><gsf:metadata name="GVDocumentOCRJSON"/></gsf:variable>
|
---|
36 | <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')}"/></gsf:variable>
|
---|
37 |
|
---|
38 | <div style="padding-top: 10px; padding-bottom: 10px;">
|
---|
39 | Google Vision OCR JSON:
|
---|
40 | <a>
|
---|
41 | <xsl:attribute name="href">
|
---|
42 | <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
|
---|
43 | <xsl:text>/index/assoc/</xsl:text><xsl:value-of disable-output-escaping="yes" select="$assocfilepath" /><xsl:text>/</xsl:text><xsl:value-of select="$GVDocumentOCRJSON"/>
|
---|
44 | </xsl:attribute>
|
---|
45 | <xsl:value-of select="$GVDocumentOCRJSON"/>
|
---|
46 | </a>
|
---|
47 | </div>
|
---|
48 | <gsf:script>
|
---|
49 | load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes);
|
---|
50 | </gsf:script>
|
---|
51 | </xsl:template>
|
---|
52 |
|
---|
53 |
|
---|
54 | <xsl:template name="wrappedSectionPost">
|
---|
55 |
|
---|
56 | <!-- add in IIIF Server link for section image -->
|
---|
57 | <xsl:variable name="nodeID" select="@nodeID"/>
|
---|
58 | <xsl:call-template name="iiif-links">
|
---|
59 | <xsl:with-param name="identifier" select="$nodeID" />
|
---|
60 | </xsl:call-template>
|
---|
61 |
|
---|
62 | <!-- add in Google Vision OCR JSON link for section image -->
|
---|
63 | <xsl:call-template name="googlevision-ocr-json">
|
---|
64 | <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" select="root"/></xsl:with-param>
|
---|
65 | </xsl:call-template>
|
---|
66 |
|
---|
67 | </xsl:template>
|
---|
68 |
|
---|
69 |
|
---|
70 | <xsl:template name="sectionContent">
|
---|
71 | <xsl:call-template name="wrappedSectionImage"/>
|
---|
72 | <div style="padding: 10px 0px 10px 0px">Ocr'd Text:</div>
|
---|
73 | <i>
|
---|
74 | <xsl:call-template name="wrappedSectionText"/>
|
---|
75 | </i>
|
---|
76 | <xsl:call-template name="wrappedSectionPost"/>
|
---|
77 | </xsl:template>
|
---|
78 |
|
---|
79 | <xsl:template name="sectionContentForEditing">
|
---|
80 | <xsl:call-template name="wrappedSectionImage"/>
|
---|
81 | <xsl:call-template name="wrappedSectionTextForEditing"/>
|
---|
82 | </xsl:template>
|
---|
83 |
|
---|
84 | <xsl:template name="documentPre">
|
---|
85 | <xsl:variable name="httpCollection">library/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:variable>
|
---|
86 | <gsf:script src="{$httpCollection}/js/document_viewer.js"/>
|
---|
87 | <style>
|
---|
88 | div.ocr-boundingbox-overlay {
|
---|
89 | position: absolute;
|
---|
90 | left: 0;
|
---|
91 | top: 0;
|
---|
92 | }
|
---|
93 |
|
---|
94 | div.ocr-boundingbox {
|
---|
95 | position: absolute;
|
---|
96 | border: solid black 1px;
|
---|
97 | }
|
---|
98 |
|
---|
99 | </style>
|
---|
100 | </xsl:template>
|
---|
101 |
|
---|
102 |
|
---|
103 | <xsl:template name="documentContentMirador">
|
---|
104 |
|
---|
105 | <gsf:script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"/>
|
---|
106 |
|
---|
107 |
|
---|
108 | <!-- By default uses Roboto font. Be sure to load this or change the font -->
|
---|
109 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
|
---|
110 | <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->
|
---|
111 |
|
---|
112 | <div style="position: relative; width: 100%; height: 800px;">
|
---|
113 | <div id="my-mirador"> <xsl:comment>filler</xsl:comment></div>
|
---|
114 | </div>
|
---|
115 |
|
---|
116 | <gsf:script>
|
---|
117 |
|
---|
118 | var mirador = Mirador.viewer({
|
---|
119 | "id": "my-mirador",
|
---|
120 | "manifests": {
|
---|
121 | "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": {
|
---|
122 | "provider": "IntermusE"
|
---|
123 | }
|
---|
124 | },
|
---|
125 | "window" : { "panels" : { "annotations": true, "attribution": false } },
|
---|
126 | "annotations": {
|
---|
127 | "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values
|
---|
128 | "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'],
|
---|
129 | },
|
---|
130 | "windows": [
|
---|
131 | {
|
---|
132 | "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
|
---|
133 | "canvasIndex": 2,
|
---|
134 | "thumbnailNavigationPosition": 'far-bottom'
|
---|
135 | }
|
---|
136 | ]
|
---|
137 | });
|
---|
138 | </gsf:script>
|
---|
139 |
|
---|
140 |
|
---|
141 | <xsl:if test="@docType='simple'">
|
---|
142 | <!-- add in IIIF Server link for simple page image -->
|
---|
143 | <xsl:call-template name="iiif-links">
|
---|
144 | <xsl:with-param name="identifier" select="$docID" />
|
---|
145 | </xsl:call-template>
|
---|
146 | </xsl:if>
|
---|
147 |
|
---|
148 |
|
---|
149 | </xsl:template>
|
---|
150 |
|
---|
151 | <xsl:template name="documentContent">
|
---|
152 | <div id="gs-document">
|
---|
153 |
|
---|
154 | <xsl:choose>
|
---|
155 | <xsl:when test="$bookswitch = 'mirador'">
|
---|
156 | <xsl:call-template name="documentPre"/>
|
---|
157 | <xsl:call-template name="documentContentMirador"/>
|
---|
158 | <xsl:call-template name="documentPost"/>
|
---|
159 | </xsl:when>
|
---|
160 | <xsl:otherwise>
|
---|
161 | <div>book swith = <xsl:value-of select="$bookswitch"/></div>
|
---|
162 | <xsl:call-template name="documentPre"/>
|
---|
163 | <xsl:call-template name="wrappedSectionImage"/>
|
---|
164 | <div id="gs-document-text">
|
---|
165 | <xsl:call-template name="documentNodeText"/>
|
---|
166 | </div>
|
---|
167 | <xsl:call-template name="documentPost"/>
|
---|
168 | </xsl:otherwise>
|
---|
169 | </xsl:choose>
|
---|
170 | </div>
|
---|
171 |
|
---|
172 | </xsl:template>
|
---|
173 |
|
---|
174 |
|
---|
175 | <xsl:template name="documentPost">
|
---|
176 | <xsl:if test="@docType='simple'">
|
---|
177 |
|
---|
178 | <!--
|
---|
179 | <gsf:switch>
|
---|
180 | <gsf:metadata name='HasGoogleVisionDocumentOCRJSON";'/>
|
---|
181 | <gsf:when test='equals' test-value="1">
|
---|
182 | -->
|
---|
183 |
|
---|
184 | <!-- add in Google Vision OCR JSON link for simple page image -->
|
---|
185 | <xsl:call-template name="googlevision-ocr-json">
|
---|
186 | <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param>
|
---|
187 | </xsl:call-template>
|
---|
188 | <!--
|
---|
189 | </gsf:when>
|
---|
190 | </gsf:switch>
|
---|
191 | -->
|
---|
192 |
|
---|
193 | </xsl:if>
|
---|
194 |
|
---|
195 |
|
---|
196 |
|
---|
197 | </xsl:template>
|
---|
198 |
|
---|
199 |
|
---|
200 | <!-- content of a simple document. Will not be used for editing mode -->
|
---|
201 | <xsl:template name="documentPostInProgress">
|
---|
202 |
|
---|
203 |
|
---|
204 | <!--
|
---|
205 | canDoEditing = <xsl:value-of select="$canDoEditing"/> <br />
|
---|
206 | editingTurnedOn = <xsl:value-of select="$editingTurnedOn"/>
|
---|
207 | -->
|
---|
208 |
|
---|
209 | <!--
|
---|
210 |
|
---|
211 | <xsl:choose>
|
---|
212 | <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true'">
|
---|
213 |
|
---|
214 | <xsl:when test="$canDoEditing = 'true'">
|
---|
215 | -->
|
---|
216 | <gsf:script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"/>
|
---|
217 |
|
---|
218 |
|
---|
219 | <!-- By default uses Roboto font. Be sure to load this or change the font -->
|
---|
220 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
|
---|
221 | <!-- Container element of Mirador whose id should be passed to the instantiating call as "id" -->
|
---|
222 |
|
---|
223 | <div style="position: relative; width: 100%; height: 800px;">
|
---|
224 | <div id="my-mirador"> <xsl:comment>filler</xsl:comment></div>
|
---|
225 | </div>
|
---|
226 |
|
---|
227 | <gsf:script>
|
---|
228 |
|
---|
229 | var mirador = Mirador.viewer({
|
---|
230 | "id": "my-mirador",
|
---|
231 | "manifests": {
|
---|
232 | "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json": {
|
---|
233 | "provider": "IntermusE"
|
---|
234 | }
|
---|
235 | },
|
---|
236 | "window" : { "panels" : { "annotations": true, "attribution": false } },
|
---|
237 | "annotations": {
|
---|
238 | "htmlSanitizationRuleSet": 'iiif', // See src/lib/htmlRules.js for acceptable values
|
---|
239 | "filteredMotivations": ['oa:commenting', 'oa:tagging', 'sc:painting', 'commenting', 'tagging'],
|
---|
240 | },
|
---|
241 | "windows": [
|
---|
242 | {
|
---|
243 | "loadedManifest": "https://intermuse.sowemustthink.space/greenstone3/sample-manifest.json",
|
---|
244 | "canvasIndex": 2,
|
---|
245 | "thumbnailNavigationPosition": 'far-bottom'
|
---|
246 | }
|
---|
247 | ]
|
---|
248 | });
|
---|
249 | </gsf:script>
|
---|
250 |
|
---|
251 | <!--
|
---|
252 | </xsl:when>
|
---|
253 | </xsl:choose>
|
---|
254 | -->
|
---|
255 |
|
---|
256 | </xsl:template>
|
---|
257 |
|
---|
258 |
|
---|
259 | </xsl:stylesheet>
|
---|