-
Notifications
You must be signed in to change notification settings - Fork 17
/
datastream_info_to_solr.xslt
executable file
·65 lines (60 loc) · 2.5 KB
/
datastream_info_to_solr.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
<?xml version="1.0" encoding="UTF-8"?>
<!-- Datastream information. -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
exclude-result-prefixes="foxml">
<xsl:template match="foxml:datastream" mode="index_object_datastreams">
<field name="fedora_datastreams_ms">
<xsl:value-of select="@ID"/>
</field>
<field name="fedora_datastreams_mimetypes_ms">
<xsl:value-of select="foxml:datastreamVersion[last()]/@MIMETYPE"/>
</field>
<xsl:call-template name="fedora_datastream_attribute_fields">
<xsl:with-param name="id" select='@ID'/>
<xsl:with-param name="prefix">fedora_datastream_info</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates mode="index_object_datastreams"/>
<xsl:call-template name="fedora_datastream_attribute_fields">
<xsl:with-param name="element" select="foxml:datastreamVersion[last()]"/>
<xsl:with-param name="prefix">fedora_datastream_latest</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="foxml:datastreamVersion" mode="index_object_datastreams">
<xsl:call-template name="fedora_datastream_attribute_fields"/>
</xsl:template>
<xsl:template name="fedora_datastream_attribute_fields">
<xsl:param name="element" select="."/>
<xsl:param name="id" select="$element/../@ID"/>
<xsl:param name="prefix">fedora_datastream_version</xsl:param>
<xsl:if test="string($index_checksums) = 'true'">
<xsl:if test="$element/foxml:contentDigest">
<field>
<xsl:attribute name="name">
<xsl:value-of select="$prefix"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="translate($element/foxml:contentDigest/@TYPE, '-', '_')"/>
<xsl:text>_checksum_ms</xsl:text>
</xsl:attribute>
<xsl:value-of select="normalize-space($element/foxml:contentDigest/@DIGEST)"/>
</field>
</xsl:if>
</xsl:if>
<xsl:for-each select="$element/@*">
<field>
<xsl:attribute name="name">
<xsl:value-of select="$prefix"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="$id"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text>_ms</xsl:text>
</xsl:attribute>
<xsl:value-of select="normalize-space(.)"/>
</field>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>