This repository has been archived by the owner on Sep 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitemap.xmap
223 lines (184 loc) · 9.76 KB
/
sitemap.xmap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?xml version="1.0" encoding="UTF-8"?>
<!--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
-->
<!-- HOW A DSPACE THEME IS PROCESSED IN 5 STEPS:
1: Generate the DRI (XML) page
The first step is to generate a DRI page for the request;
this is handled by the Aspect chain. Once it is generated
it is the beginning of a theme's pipeline, the DRI page is
ultimately transformed in the resulting XHTML that is
given to the user's browser.
2: Add page metadata (to DRI) - see "transform-to-xhtml" resource
The next step is to add theme specific metadata to the
DRI page. This is metadata about where the theme is
located and its name. Typically this metadata is different
depending on the users browser, this allows us to give
different stylesheets to Internet Explorer than for other browsers.
3: Transform DRI to XHTML (via XSLT) - see "transform-to-xhtml" resource
The third step is the main component of a theme. The XSL
transformations will turn the DRI page from the aspects
into an XHTML page useable by browsers.
4: Localize the page (by replacing i18n tags) - see "transform-to-xhtml" resource
The second to last step is to localize the content for the
particular user, if they user is requesting a page in a
particular language then those language strings are inserted
into the resulting XHTML.
5: Serialize to the browser
The last step sends the XHTML page to the user's browser.
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:readers>
<map:reader name="ConcatenationReader" src="org.dspace.app.xmlui.cocoon.ConcatenationReader"/>
</map:readers>
<map:transformers>
<transformer name="strip-namespaces" src="org.apache.cocoon.transformation.StripNameSpacesTransformer"/>
</map:transformers>
<map:serializers>
<map:serializer name="html-no-doctype" logger="sitemap.serializer.xhtml"
src="org.apache.cocoon.serialization.HTMLSerializer"
mime-type="text/html; charset=utf-8"
pool-grow="2" pool-max="64" pool-min="2">
<encoding>UTF-8</encoding>
<indent>yes</indent>
</map:serializer>
</map:serializers>
</map:components>
<!-- Define global resources that are used in multiple areas of the pipeline. -->
<map:resources>
<!--
This "transform-to-xhtml" resource is in charge of transforming DRI to XHTML.
It expects a pre-generated DRI page. It adds needed CSS/JS references to that DRI,
and then transforms it to XHTML using the Theme's XSLT(s).
Please note: this Sitemap 'resource' can be called from multiple places (almost like a function).
-->
<map:resource name="transform-to-xhtml">
<!-- Fix some overly convoluted DRI constructs in
DSpace code without having to change java code and
interfere with other themes -->
<map:transform src="xsl/preprocess.xsl"/>
<!-- Add page metadata to DRI -->
<map:transform type="IncludePageMeta">
<map:parameter name="theme.path" value="{global:theme-path}/"/>
<map:parameter name="theme.name" value="{global:theme-name}/"/>
</map:transform>
<!-- Debugging output (this is only called when ?XML is passed on querystring) -->
<!-- It allows developers to view the final DRI XML, in order to build/debug theme XSLTs -->
<map:match type="request" pattern="XML">
<map:serialize type="xml"/>
</map:match>
<!-- Transform DRI to XHTML using the Theme's XSLT(s) -->
<map:transform src="xsl/theme.xsl"/>
<!-- Localize the XHTML page (by replacing i18n tags) -->
<map:act type="locale">
<map:transform type="i18n">
<map:parameter name="locale" value="{locale}"/>
</map:transform>
</map:act>
<!-- Remove all namespaces in the output xhtml-->
<map:transform type="strip-namespaces" />
</map:resource>
</map:resources>
<map:pipelines>
<!--
Define global theme variables that are used later in this
sitemap. Two variables are typically defined here, the theme's
path and name. The path is the directory name where this theme
is located, such as "Reference" for the reference theme. The
theme's name is used only for descriptive purposes to describe
the theme.
-->
<map:component-configurations>
<global-variables>
<theme-path>Mirage2</theme-path>
<theme-name>Mirage2</theme-name>
</global-variables>
</map:component-configurations>
<!--
Caching Pipeline: This caching pipeline handles access to static content (css, js, etc)
which is used by this Theme. These static files are simply passed directly to
the user's browser without any proccesing.
-->
<map:pipeline>
<!-- Allow the browser to cache static content for an hour -->
<map:parameter name="expires" value="access plus 1 hours"/>
<!-- handle static js and css -->
<map:match pattern="themes/*/**.js">
<map:read type="ConcatenationReader" src="{2}.js">
<map:parameter name="requestQueryString" value="{request:queryString}"/>
</map:read>
</map:match>
<map:match pattern="themes/*/**.css">
<map:read type="ConcatenationReader" src="{2}.css">
<map:parameter name="requestQueryString" value="{request:queryString}"/>
</map:read>
</map:match>
<map:match pattern="themes/*/**.json">
<map:read type="ConcatenationReader" src="{2}.json">
<map:parameter name="requestQueryString" value="{request:queryString}"/>
</map:read>
</map:match>
<!-- Static content -->
<map:match pattern="themes/*/**">
<map:read src="{2}"/>
</map:match>
</map:pipeline>
<!--
Primary (non-caching) Pipeline:
This pipeline is the one that generates *dynamic* content. It first creates
the DRI (XML) by calling the Aspect chain. Then it transforms that DRI
into the XHTML page which is passed to the user.
-->
<map:pipeline>
<!-- Never allow the browser to cache dynamic content -->
<map:parameter name="expires" value="now"/>
<map:match pattern="**">
<!-- Step 1: Generate the DRI page -->
<!-- This line actually initiates the Aspect chain. The Aspect chain will build
the DRI (XML) content based on which page the user is accessing. -->
<map:generate type="file" src="cocoon://DRI/{1}"/>
<!-- Step 2: Transform the DRI page into XHTML -->
<!-- This line calls the resource named 'transform-to-xhtml' (included above).
That resource is in charge of tranforming this DRI content into HTML -->
<map:call resource="transform-to-xhtml"/>
<!-- Step 3: Serialize to the browser (sends final HTML to user's browser) -->
<map:serialize type="html-no-doctype"/>
</map:match>
</map:pipeline>
<!--
Handle any errors which are thrown during any step in the above pipelines.
This would include simple invalid URL errors (404 page not found), as well as
any errors that may occur from the Aspect chain, or from the Theme itself.
-->
<map:handle-errors>
<!-- Step 1: Tell Cocoon to generate an XML formatted exception message -->
<map:generate type="exception"/>
<!-- Step 2: Transform that Cocoon XML exception into valid DRI (using exception2dri.xslt)-->
<map:transform src="../../exception2dri.xslt">
<map:parameter name="contextPath" value="{request:contextPath}"/>
</map:transform>
<!-- Step 3: Transform that DRI formatted exception into XHTML (using our Theme) -->
<map:call resource="transform-to-xhtml"/>
<!-- Step 4: Serialize XHTML page to user's brower. Based on the type of error,
provide a different HTTP response code. -->
<map:select type="exception">
<!-- HTTP 400 Bad Request -->
<map:when test="bad-request">
<map:serialize type="html-no-doctype" status-code="400"/>
</map:when>
<!-- HTTP 404 Page Not Found -->
<map:when test="not-found">
<map:serialize type="html-no-doctype" status-code="404"/>
</map:when>
<!-- All other errors (HTTP 500 Internal Server Error) -->
<map:otherwise>
<map:serialize type="html-no-doctype" status-code="500"/>
</map:otherwise>
</map:select>
</map:handle-errors>
</map:pipelines>
</map:sitemap>