-
Notifications
You must be signed in to change notification settings - Fork 47
/
foxmlToSolr.xslt
345 lines (316 loc) · 22 KB
/
foxmlToSolr.xslt
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" encoding="UTF-8"?>
<!-- We need all lower level namespaces to be declared here for exclude-result-prefixes attributes
to be effective -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:zs="http://www.loc.gov/zing/srw/"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:rel="info:fedora/fedora-system:def/relations-external#"
xmlns:fedora-model="info:fedora/fedora-system:def/model#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:fedora="info:fedora/fedora-system:def/relations-external#"
xmlns:dwc="http://rs.tdwg.org/dwc/xsd/simpledarwincore/"
xmlns:uvalibdesc="http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd"
xmlns:uvalibadmin="http://dl.lib.virginia.edu/bin/admin/admin.dtd/"
xmlns:res="http://www.w3.org/2001/sw/DataAccess/rf1/result"
xmlns:eaccpf="urn:isbn:1-931666-33-4"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl"
xmlns:islandora-exts="xalan://ca.upei.roblib.DataStreamForXSLT"
exclude-result-prefixes="exts"
xmlns:encoder="xalan://java.net.URLEncoder"
xmlns:java="http://xml.apache.org/xalan/java"
xmlns:dgi-e="xalan://ca.discoverygarden.gsearch_extensions"
xmlns:sparql="http://www.w3.org/2001/sw/DataAccess/rf1/result"
xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<!-- gsearch magik @TODO: see if any of the explicit variables can be replaced by these -->
<xsl:param name="REPOSITORYNAME" select="repositoryName"/>
<xsl:param name="FEDORASOAP" select="repositoryName"/>
<xsl:param name="FEDORAUSER" select="repositoryName"/>
<xsl:param name="FEDORAPASS" select="repositoryName"/>
<xsl:param name="TRUSTSTOREPATH" select="repositoryName"/>
<xsl:param name="TRUSTSTOREPASS" select="repositoryName"/>
<!--
Parameter(s) from custom_parameters.properties.
-->
<xsl:param name="index_ancestors" select="false()"/>
<xsl:param name="index_ancestors_models" select="false()"/>
<xsl:param name="maintain_dataset_latest_version_flag" select="false()"/>
<xsl:param name="index_compound_sequence" select="true()"/>
<xsl:param name="index_checksums" select="false()"/>
<!-- These values are accessible in included xslts -->
<xsl:variable name="PROT">http</xsl:variable>
<xsl:variable name="HOST">localhost</xsl:variable>
<xsl:variable name="PORT">8080</xsl:variable>
<xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
<!-- Used for indexing other objects.
<xsl:variable name="FEDORA" xmlns:java_string="xalan://java.lang.String" select="substring($FEDORASOAP, 1, java_string:lastIndexOf(java_string:new(string($FEDORASOAP)), '/'))"/>
-->
<!--
This xslt stylesheet generates the IndexDocument consisting of IndexFields
from a FOXML record. The IndexFields are:
- from the root element = PID
- from foxml:property = type, state, contentModel, ...
- from oai_dc:dc = title, creator, ...
The IndexDocument element gets a PID attribute, which is mandatory,
while the PID IndexField is optional.
-->
<!-- These includes are for transformations on individual datastreams;
disable the ones you do not want to perform;
the paths may need to be updated if the standard install was not followed
TODO: look into a way to make these paths relative -->
<!-- older gsearches (slurp_all_MODS_to_solr also contains an include that would need to be
altered if you use these)-->
<!-- The name of the 'config' directory has changed in newer versions of fedoragsearch.
If your installation uses 'WEB-INF/classes/config' enable the import block below, and
disable the import block using 'WEB-INF/classes/fgsconfigFinal'.
-->
<!--
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/DC_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/RELS-EXT_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/RELS-INT_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/FOXML_properties_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/datastream_info_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/slurp_all_MODS_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/slurp_all_ead_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/MODS_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/EACCPF_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/TEI_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/text_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/XML_to_one_solr_field.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/XML_text_nodes_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/MADS_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/WORKFLOW_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/slurp_all_chemicalML_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/library/traverse-graph.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/hierarchy.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/or_transcript_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/FgsIndex/islandora_transforms/vtt_solr.xslt"/>
-->
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/DC_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/QDC_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/RELS-EXT_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/RELS-INT_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/FOXML_properties_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/datastream_info_to_solr.xslt"/>
<!--<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/MODS_to_solr.xslt"/>-->
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/slurp_all_MODS_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/slurp_all_ead_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/EACCPF_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/TEI_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/text_to_solr.xslt"/>
<!--<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/XML_to_one_solr_field.xslt"/>-->
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/XML_text_nodes_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/MADS_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/WORKFLOW_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/slurp_all_chemicalML_to_solr.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/slurp_XML_converted_JSON_to_solr.xslt"/>
<!--<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/or_transcript_solr.xslt"/>-->
<!--<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/vtt_solr.xslt"/>-->
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/library/traverse-graph.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/hierarchy.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/ancestors_models_to_solr_field.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/library/xslt-date-template.xslt"/>
<xsl:include href="/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/research_data_versions.xslt"/>
<!-- Decide which objects to modify the index of -->
<xsl:template match="/">
<update>
<!-- The following allows only active and data oriented FedoraObjects to be indexed -->
<xsl:if test="not(foxml:digitalObject/foxml:datastream[@ID='METHODMAP' or @ID='DS-COMPOSITE-MODEL'])">
<xsl:choose>
<xsl:when test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and @VALUE='Active']">
<xsl:variable name="doc">
<xsl:apply-templates select="/foxml:digitalObject" mode="indexFedoraObject">
<xsl:with-param name="PID" select="$PID"/>
</xsl:apply-templates>
</xsl:variable>
<add>
<xsl:copy-of select="$doc"/>
</add>
<xsl:if test="$maintain_dataset_latest_version_flag">
<xsl:call-template name="reindex_previous_newest_research_data_set_version_if_necessary">
<xsl:with-param name="current" select="xalan:nodeset($doc)"/>
</xsl:call-template>
</xsl:if>
<!-- Newspaper graph example.
<xsl:variable name="graph">
<xsl:call-template name="_traverse_graph">
<xsl:with-param name="risearch" select="concat($FEDORA, '/risearch')"/>
<xsl:with-param name="to_traverse_in">
<sparql:result>
<sparql:obj>
<xsl:attribute name="uri">info:fedora/<xsl:value-of select="$PID"/></xsl:attribute>
</sparql:obj>
</sparql:result>
</xsl:with-param>
<xsl:with-param name="query">
PREFIX fre: <info:fedora/fedora-system:def/relations-external#>
PREFIX fm: <info:fedora/fedora-system:def/model#>
PREFIX islandora: <http://islandora.ca/ontology/relsext#>
SELECT ?obj
FROM <#ri>
WHERE {
{
<%PID_URI%> fm:hasModel <info:fedora/islandora:newspaperCModel> {
?issue fre:isMemberOf <%PID_URI%> .
?obj islandora:isPageOf ?issue
}
UNION {
?obj fre:isMemberOf <%PID_URI%>
}
}
UNION {
<%PID_URI%> fm:hasModel <info:fedora/islandora:newspaperIssueCModel> .
?obj islandora:isPageOf <%PID_URI%>
}
?obj fm:state fm:Active
}
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<add commitWithin="5000">
<xsl:for-each select="xalan:nodeset($graph)//sparql:obj[@uri != concat('info:fedora/', $PID)]">
<xsl:variable name="xml_url" select="concat(substring-before($FEDORA, '://'), '://', encoder:encode($FEDORAUSER), ':', encoder:encode($FEDORAPASS), '@', substring-after($FEDORA, '://') , '/objects/', substring-after(@uri, '/'), '/objectXML')"/>
<xsl:variable name="object" select="document($xml_url)"/>
<xsl:if test="$object">
<xsl:apply-templates select="$object/foxml:digitalObject" mode="indexFedoraObject">
<xsl:with-param name="PID" select="substring-after(@uri, '/')"/>
</xsl:apply-templates>
</xsl:if>
</xsl:for-each>
</add>
-->
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/foxml:digitalObject" mode="unindexFedoraObject"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</update>
</xsl:template>
<!-- Index an object -->
<xsl:template match="/foxml:digitalObject" mode="indexFedoraObject">
<xsl:param name="PID"/>
<xsl:param name="version" select="false()"/>
<doc>
<!-- put the object pid into a field -->
<field name="PID">
<xsl:value-of select="$PID"/>
</field>
<xsl:if test="$version">
<field name="_version_">
<xsl:value-of select="$version"/>
</field>
</xsl:if>
<!-- These templates are in the islandora_transforms -->
<xsl:apply-templates select="foxml:objectProperties/foxml:property"/>
<xsl:apply-templates select="/foxml:digitalObject" mode="index_object_datastreams"/>
<!-- THIS IS SPARTA!!!
These lines call a matching template on every datastream id so that you only have to edit included files
handles inline and managed datastreams
The datastream level element is used for matching,
making it imperative to use the $content parameter for xpaths in templates
if they are to support managed datstreams -->
<!-- TODO: would like to get rid of the need for the content param -->
<xsl:for-each select="foxml:datastream">
<xsl:choose>
<xsl:when test="@CONTROL_GROUP='X'">
<xsl:apply-templates select="foxml:datastreamVersion[last()]">
<xsl:with-param name="content" select="foxml:datastreamVersion[last()]/foxml:xmlContent"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@CONTROL_GROUP='M' and foxml:datastreamVersion[last()][@MIMETYPE='text/xml' or @MIMETYPE='application/xml' or @MIMETYPE='application/rdf+xml' or @MIMETYPE='text/html' or @MIMETYPE='chemical/x-cml']">
<!-- TODO: should do something about mime type filtering
text/plain should use the getDatastreamText extension because document will only work for xml docs
xml files should use the document function
other mimetypes should not be being sent
will this let us not use the content variable? -->
<xsl:apply-templates select="foxml:datastreamVersion[last()]">
<xsl:with-param name="content" select="document(concat($PROT, '://', encoder:encode($FEDORAUSER), ':', encoder:encode($FEDORAPASS), '@', $HOST, ':', $PORT, '/fedora/objects/', $PID, '/datastreams/', @ID, '/content'))"/>
</xsl:apply-templates>
</xsl:when>
<!-- JSON to document objects -->
<xsl:when test="@CONTROL_GROUP='M' and foxml:datastreamVersion[last() and @MIMETYPE='application/json']">
<xsl:apply-templates select="foxml:datastreamVersion[last()]">
<xsl:with-param name="content" select="dgi-e:JSONToXML.convertJSONToDocument(dgi-e:FedoraUtils.getRawDatastreamDissemination($PID, @ID, concat($PROT, '://', $HOST, ':', $PORT, '/fedora'), $FEDORAUSER, $FEDORAPASS))"/>
</xsl:apply-templates>
</xsl:when>
<!-- non-xml managed datastreams...
Really, should probably only
handle the mimetypes supported by the "getDatastreamText" call:
https://github.com/fcrepo/gsearch/blob/master/FedoraGenericSearch/src/java/dk/defxws/fedoragsearch/server/TransformerToText.java#L185-L200
-->
<xsl:when test="@CONTROL_GROUP='M' and foxml:datastreamVersion[last() and not(starts-with(@MIMETYPE, 'image') or starts-with(@MIMETYPE, 'audio') or starts-with(@MIMETYPE, 'video') or @MIMETYPE = 'application/pdf' or @MIMETYPE = 'application/octet-stream' or @MIMETYPE = 'application/mxf' or @MIMETYPE = 'application/zip' or @MIMETYPE = 'application/x-zip')]">
<!-- TODO: should do something about mime type filtering
text/plain should use the getDatastreamText extension because document will only work for xml docs
xml files should use the document function
other mimetypes should not be being sent
will this let us not use the content variable? -->
<xsl:apply-templates select="foxml:datastreamVersion[last()]">
<xsl:with-param name="content" select="dgi-e:XMLStringUtils.escapeForXML(normalize-space(exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)))"/>
</xsl:apply-templates>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- this is an example of using template modes to have multiple ways of indexing the same stream -->
<!--
<xsl:apply-templates select="foxml:datastream[@ID='EAC-CPF']/foxml:datastreamVersion[last()]/foxml:xmlContent//eaccpf:eac-cpf">
<xsl:with-param name="pid" select="$PID"/>
</xsl:apply-templates>
<xsl:apply-templates mode="fjm" select="foxml:datastream[@ID='EAC-CPF']/foxml:datastreamVersion[last()]/foxml:xmlContent//eaccpf:eac-cpf">
<xsl:with-param name="pid" select="$PID"/>
<xsl:with-param name="suffix">_s</xsl:with-param>
</xsl:apply-templates>
-->
<!-- Index ancestors, as used in the islandora_collection_search module.
Also, note: When migrating objects between collections, it would be
necessary to update all descendents to ensure their list of ancestors
reflect the current state... We do this in the
islandora_collection_search module when migrating, instead of
reindexing all the descendents whenever indexing an object
(updating a collection label would be fairly expensive if we blindly
reindexed). -->
<!-- XXX: Parameters as passed in are strings... Let's deal with it as a
string here, for convenience. -->
<xsl:if test="string($index_ancestors) = 'true'">
<xsl:variable name="ancestors">
<xsl:call-template name="get-ancestors">
<xsl:with-param name="PID" select="$PID" />
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="xalan:nodeset($ancestors)//sparql:obj[@uri != concat('info:fedora/', $PID)]">
<field name="ancestors_ms"><xsl:value-of select="substring-after(@uri, '/')"/></field>
</xsl:for-each>
</xsl:if>
<xsl:if test="string($index_ancestors_models) = 'true'">
<xsl:variable name="ancestors_models">
<xsl:call-template name="get-ancestors-models">
<xsl:with-param name="PID" select="$PID"/>
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="xalan:nodeset($ancestors_models)//sparql:model">
<field name="ancestors_models_ms"><xsl:value-of select="substring-after(@uri, '/')"/></field>
</xsl:for-each>
</xsl:if>
</doc>
</xsl:template>
<!-- Delete the solr doc of an object -->
<xsl:template match="/foxml:digitalObject" mode="unindexFedoraObject">
<xsl:comment> name="PID" This is a hack, because the code requires that to be present </xsl:comment>
<delete>
<id>
<xsl:value-of select="$PID"/>
</id>
</delete>
</xsl:template>
<!-- This prevents text from just being printed to the doc without field elements JUST TRY COMMENTING IT OUT -->
<xsl:template match="text()"/>
<xsl:template match="text()" mode="indexFedoraObject"/>
<xsl:template match="text()" mode="unindexFedoraObject"/>
<xsl:template match="text()" mode="index_object_datastreams"/>
</xsl:stylesheet>