Changeset 37099 for main/trunk/greenstone3/web/interfaces/default/transform/pages/document-iiif-manifest.xsl
- Timestamp:
- 2023-01-04T21:15:35+13:00 (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/pages/document-iiif-manifest.xsl
r37094 r37099 24 24 <xsl:include href="pages/document-vars.xsl" /> 25 25 26 27 <xsl:output method="html" version="1.0" encoding="utf-8"/> 28 26 <!-- Additional changes needed to GS3 Java runtine for the following output tag to operate correctly --> 27 <!-- Testing with o=xsl and the debug XML+XSL pair of files generated (when an error was encountred) 28 showed that the Greenstone3 runtime does not currently honour the output tag, in fact gslib.xsl 29 entries seem to turn up later on, and as this includes html-output.xsl, then a later xsl:output 30 tag is generated. The problems runner deeper than this however, with the XSLT output generated 31 having a DTD. Looks like gsdl3/TransformingReceptionist.java is geared to always generating 32 XML output of some form of other (e.g. RSS XML output). Generating raw text just doesn't 33 seem to get through. So to make progress have introduced CGI argument 'excerptid-text' 34 as a way of getting to the text that is generated within, say, a <pre> elemlent with an id attribute --> 29 35 <!-- 30 36 <xsl:output method="text" version="1.0" encoding="utf-8" omit-xml-declaration="yes"/> … … 33 39 34 40 <xsl:variable name="iiifPresentationRootIdentifier">http-greenstone://<xsl:value-of select="$site_name"/>/<xsl:value-of select="$collNameChecked"/>/<xsl:value-of select="$docID"/></xsl:variable> 35 41 36 42 <xsl:template match="/"> 37 43 <html> 38 44 <body> 39 <pre >40 <xsl:apply-templates select="/page/pageResponse/document" />45 <pre id="iiif-manifest"> 46 <xsl:apply-templates select="/page/pageResponse/document" /> 41 47 </pre> 42 48 </body> 43 49 </html> 44 45 50 </xsl:template> 46 51 … … 59 64 60 65 <xsl:template name="wrappedDocumentTopLevel"> 61 62 66 <!-- <xsl:call-template name="documentPre"/> --> 63 67 <xsl:call-template name="wrappedDocument"/> <!-- without ed=1, this template misses the binds in of documentPre and documentPost --> 64 68 <!-- <xsl:call-template name="documentPost"/> --> 65 66 </xsl:template> 67 69 </xsl:template> 68 70 69 71 <xsl:template name="wrappedDocument"> 70 71 72 <xsl:call-template name="documentPre"/> 72 73 <xsl:for-each select="documentNode"> 73 74 <xsl:call-template name="wrapDocumentNodes"/> 74 75 </xsl:for-each> 75 <xsl:call-template name="documentPost"/> 76 77 </xsl:template> 78 79 76 <xsl:call-template name="documentPost"/> 77 </xsl:template> 78 79 80 80 <xsl:template name="iiif-other-content"> 81 <xsl:param name="optSection"/> 82 81 <xsl:param name="optSection"/> 83 82 <xsl:variable name="baseURL">https:<xsl:value-of select="/page/pageRequest/@baseURL"/></xsl:variable> <!-- **** had to hardwire https: --> 84 < !-- **** test for a gsf-option before include !!!! -->85 86 83 <xsl:if test="/page/pageResponse/format[@type='display']/gsf:option[@name='includeFileAssocOpenAnnotations']/@value='true'"> 84 "otherContent": [{ 85 "@id": "<xsl:value-of select="$baseURL"/><xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collNameChecked"/>/index/assoc/<gsf:metadata name="assocfilepath" select="root"/>/openannotation-list<xsl:value-of select="$optSection"/>.json", 87 86 "@type": "sc:AnnotationList" 88 87 }], 88 </xsl:if> 89 89 </xsl:template> 90 90 … … 93 93 <xsl:param name="identifier"/> 94 94 <xsl:param name="docType"/> 95 95 <!-- --> 96 96 <xsl:variable name="iiifImageRootIdentifier"> 97 97 <xsl:text>/gs-cantaloupe/iiif/2/</xsl:text><xsl:value-of select="$site_name"/>:<xsl:value-of select="$collNameChecked"/>:<xsl:value-of select="$identifier"/> … … 100 100 <!-- page/pageRequest[@baseURL]="//intermuse.sowemustthink.space/greenstone3/ --> 101 101 <!-- page/pageRequest[@fullURL]="//intermuse.sowemustthink.space/greenstone3/library?a=d.... --> 102 103 <!-- ***** need to work out domain name to use from raw XML message, say processing something from the above --> 104 102 <!-- ***** need to work out domain name to use from raw XML message, say processing something from the above --> 105 103 <xsl:variable name="window-location-origin">https://intermuse.sowemustthink.space</xsl:variable> 106 104 … … 112 110 </xsl:choose> 113 111 </xsl:variable> 114 115 116 112 <xsl:variable name="chosenTitle"> 117 113 <xsl:choose> … … 122 118 </xsl:choose> 123 119 </xsl:variable> 124 125 120 <!-- The following is useful for debugging, nested in 'pre' tags --> 126 121 <!-- … … 137 132 --> 138 133 <!-- an array entry in 'canvases': { @content, @id, @type, label, width, height, images[{}], thumbnail {@id,@type} } --> 139 134 <!-- add a comma first, if it is not the first canvas element in the array --> 140 135 <xsl:if test="$section > 1"> 141 136 , 142 137 </xsl:if> 143 { 144 "@context": "http://iiif.io/api/presentation/2/context.json", 145 "@id": "<xsl:value-of select="$iiifPresentationRootIdentifier" />/canvas/<xsl:value-of select="$section"/>", 146 "@type": "sc:Canvas", 147 "label": "<xsl:value-of select="$chosenTitle"/>", 148 <xsl:call-template name="iiif-other-content"> 149 <xsl:with-param name="optSection"><xsl:value-of select="$optSection"/></xsl:with-param> 150 </xsl:call-template> 151 "width": <gsf:metadata name="ImageWidth"/>, 152 "height": <gsf:metadata name="ImageHeight"/>, 153 154 "images": [{ 155 "image": { 156 "@context": "http://iiif.io/api/image/2/context.json", 157 "@type": "oa:Annotation", 158 "motivation": "sc:painting", 159 "on": "<xsl:value-of select="$iiifPresentationRootIdentifier" />/annotation/<xsl:value-of select="$section"/>", 160 161 "resource": { 162 "@id": "<xsl:value-of select="$window-location-origin" /><xsl:value-of select="$iiifImageRootIdentifier" />/full/full/0/default.jpg", 163 "@type": "dctypes:Image", 164 "format": "image/jpeg", 165 "width": <gsf:metadata name="ImageWidth"/>, 166 "hieght": <gsf:metadata name="ImageHeight"/>, 167 "service": { 168 "@context": "http://iiif.io/api/image/2/context.json", 169 "@id": "<xsl:value-of select="$window-location-origin" /><xsl:value-of select="$iiifImageRootIdentifier" />", 170 "profile": "https://iiif.io/api/image/2/profiles/level2.json" 171 } 172 } 173 } 174 }], 175 "thumbnail": { 176 "@id": "<xsl:value-of select="$window-location-origin" /><xsl:value-of select="$iiifImageRootIdentifier" />/full/,150/0/default.jpg", 177 "@type": "dctypes:Image" 178 } 138 { 139 "@context": "http://iiif.io/api/presentation/2/context.json", 140 "@id" : "<xsl:value-of select="$iiifPresentationRootIdentifier" />/canvas/<xsl:value-of select="$section"/>", 141 "@type" : "sc:Canvas", 142 "label" : "<xsl:value-of select="$chosenTitle"/>", 143 <xsl:call-template name="iiif-other-content"> 144 <xsl:with-param name="optSection"><xsl:value-of select="$optSection"/></xsl:with-param> 145 </xsl:call-template> 146 "width" : <gsf:metadata name="ImageWidth"/>, 147 "height" : <gsf:metadata name="ImageHeight"/>, 148 "images": [{ 149 "@context": "http://iiif.io/api/image/2/context.json", 150 "@id": "<xsl:value-of select="$iiifPresentationRootIdentifier" />/annotation/<xsl:value-of select="$section"/>", 151 "@type": "oa:Annotation", 152 "motivation": "sc:painting", 153 "on": "<xsl:value-of select="$iiifPresentationRootIdentifier" />/canvas", 154 "resource": { 155 "@id": "<xsl:value-of select="$window-location-origin" /><xsl:value-of select="$iiifImageRootIdentifier" />/full/full/0/default.jpg", 156 "@type": "dctypes:Image", 157 "format": "image/jpeg", 158 "width": <gsf:metadata name="ImageWidth"/>, 159 "hieght": <gsf:metadata name="ImageHeight"/>, 160 "service": { 161 "@context": "http://iiif.io/api/image/2/context.json", 162 "@id": "<xsl:value-of select="$window-location-origin" /><xsl:value-of select="$iiifImageRootIdentifier" />", 163 "profile": "https://iiif.io/api/image/2/profiles/level2.json" 164 } 165 } 166 }], 167 "thumbnail": { 168 "@id": "<xsl:value-of select="$window-location-origin" /><xsl:value-of select="$iiifImageRootIdentifier" />/full/,150/0/default.jpg", 169 "@type": "dctypes:Image" 170 } 179 171 } 180 172 <!-- Another field to consider in the above JSON is: --> … … 207 199 <xsl:variable name="toplevelChosenTitle"> 208 200 <xsl:choose> 209 201 <xsl:when test="@docType='simple'"> 210 202 <xsl:call-template name="choose-title"/> 211 203 </xsl:when> … … 219 211 { 220 212 "@context": "http://iiif.io/api/presentation/2/context.json", 221 222 223 224 225 226 213 "@type": "sc:Manifest", 214 "@id": "<xsl:value-of select="$iiifPresentationRootIdentifier"/>/manifest", 215 "label": "<xsl:value-of select="$toplevelChosenTitle"/>", 216 "attribution": "The Internet of Musical Events (InterMusE): Digital Scholarship, Community, and the Archiving of Performance", 217 "license": "https://**** To Be Determined ****", 218 "logo": "https://intermuse.datatodata.org/wp-content/uploads/sites/4/2021/03/cropped-cropped-cropped-1.png", 227 219 "metadata": [ 228 229 230 231 232 233 220 { "label": "creator", "value": ["aaa1","aaa2"] }, 221 { "label": "title", "value": ["chosen-title"] } 222 ], 223 <!-- trival IIIF sequences => has one IIIF canvas in it --> 224 "sequences": [{ 225 "@context": "http://iiif.io/api/image/2/context.json", 234 226 "@id": "<xsl:value-of select="$iiifPresentationRootIdentifier"/>/sequence/normal", 235 227 "@type": "sc:Sequence", 236 "canvases": [ 237 228 "canvases": [ 238 229 </xsl:template> 239 230 … … 264 255 <xsl:if test="documentNode"> 265 256 <xsl:for-each select="documentNode"> 266 257 <xsl:call-template name="wrapDocumentNodes"/> 267 258 </xsl:for-each> 268 259 </xsl:if> … … 281 272 }] 282 273 } 283 284 274 </xsl:template> 285 275
Note:
See TracChangeset
for help on using the changeset viewer.