forked from DGI-UoM/UofM_gsearch_config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gfindObjectsToResultPage.xslt
88 lines (74 loc) · 2.58 KB
/
gfindObjectsToResultPage.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
<?xml version="1.0" encoding="UTF-8"?>
<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:dc="http://purl.org/dc/elements/1.1/">
<!-- This xslt stylesheet generates the resultPage
from a Solr search.
-->
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:param name="QUERY" select="query"/>
<xsl:param name="HITPAGESTART" select="1"/>
<xsl:param name="HITPAGESIZE" select="10"/>
<xsl:param name="RESULTPAGEXSLT" select="resultPageXslt"/>
<xsl:param name="DATETIME" select="none"/>
<xsl:template match="solrsearch">
<xsl:variable name="INDEXNAME" select="@indexName"/>
<xsl:variable name="HITTOTAL" select="@hitTotal"/>
<resultPage dateTime="{$DATETIME}"
indexName="{$INDEXNAME}">
<gfindObjects query="{$QUERY}"
hitPageStart="{$HITPAGESTART}"
hitPageSize="{$HITPAGESIZE}"
resultPageXslt="{$RESULTPAGEXSLT}"
hitTotal="{$HITTOTAL}">
<objects>
<xsl:for-each select="hit">
<object>
<xsl:attribute name="no">
<xsl:value-of select="@no"/>
</xsl:attribute>
<xsl:attribute name="score">
<xsl:value-of select="@score"/>
</xsl:attribute>
<xsl:copy-of select="node()"/>
<!--
<xsl:choose>
<xsl:when test="dc.title">
<field name="title"><xsl:value-of select="dc.title/node()"/>
</field>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="dc.description">
<xsl:variable name="SNIPPET" select="dc.description"/>
<xsl:choose>
<xsl:when test="string-length($SNIPPET)>50">
<field name="snippet"><xsl:value-of select="concat(substring($SNIPPET, 1, 50), '...')"/></field>
</xsl:when>
<xsl:otherwise>
<field name="snippet"><xsl:value-of select="$SNIPPET"/></field>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="SNIPPET" select="description"/>
<xsl:choose>
<xsl:when test="string-length($SNIPPET)>500">
<field name="snippet"><xsl:value-of select="concat(substring($SNIPPET, 1, 50), '...')"/></field>
</xsl:when>
<xsl:otherwise>
<field name="snippet"><xsl:copy-of select="$SNIPPET"/></field>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
-->
</object>
</xsl:for-each>
</objects>
</gfindObjects>
</resultPage>
</xsl:template>
</xsl:stylesheet>