1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!-- $Id: demoFoxmlToLucene.xslt,v 1.3 2006/11/28 11:19:42 gertsp Exp $ -->
|
---|
3 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exts="xalan://dk.defxws.fedoragsearch.server.XsltExtensions" exclude-result-prefixes="exts" 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/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:uvalibdesc="http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd" xmlns:uvalibadmin="http://dl.lib.virginia.edu/bin/admin/admin.dtd/"
|
---|
4 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="info:fedora/fedora-system:def/relations-external#">
|
---|
5 | <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
|
---|
6 | <xsl:param name="REPOSITORYNAME" select="repositoryName"/>
|
---|
7 | <xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
|
---|
8 | <xsl:variable name="docBoost" select="1.4*2.5"/>
|
---|
9 | <!-- or any other calculation, default boost is 1.0 -->
|
---|
10 |
|
---|
11 | <xsl:template match="/">
|
---|
12 | <IndexDocument>
|
---|
13 | <!-- The PID attribute is mandatory for indexing to work -->
|
---|
14 | <xsl:attribute name="PID"><xsl:value-of select="$PID"/></xsl:attribute>
|
---|
15 | <xsl:attribute name="boost"><xsl:value-of select="$docBoost"/></xsl:attribute>
|
---|
16 | <!-- The following allows only active demo FedoraObjects to be indexed. -->
|
---|
17 | <!-- <xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and @VALUE='Active']"> -->
|
---|
18 | <xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and (@VALUE='Active' or @VALUE='Inactive')]">
|
---|
19 |
|
---|
20 | <xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type' and @VALUE='FedoraObject']">
|
---|
21 | <xsl:if test="starts-with($PID,'greenstone')">
|
---|
22 | <!-- filter out annotations: -->
|
---|
23 | <!--
|
---|
24 | <xsl:choose>
|
---|
25 | <xsl:when test="foxml:digitalObject/foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/rdf:RDF/rdf:Description/rel:isMemberOf[@rdf:resource='info:fedora/mura:annotations']">
|
---|
26 | </xsl:when>
|
---|
27 | <xsl:otherwise>
|
---|
28 | -->
|
---|
29 | <xsl:apply-templates mode="activeDemoFedoraObject"/>
|
---|
30 | <!--
|
---|
31 | </xsl:otherwise>
|
---|
32 | </xsl:choose>
|
---|
33 | -->
|
---|
34 | </xsl:if>
|
---|
35 | </xsl:if>
|
---|
36 |
|
---|
37 | </xsl:if>
|
---|
38 | </IndexDocument>
|
---|
39 | </xsl:template>
|
---|
40 |
|
---|
41 | <xsl:template match="/foxml:digitalObject" mode="activeDemoFedoraObject">
|
---|
42 |
|
---|
43 | <IndexField IFname="PID" index="UN_TOKENIZED" store="YES" termVector="NO" boost="2.5">
|
---|
44 | <xsl:value-of select="$PID"/>
|
---|
45 | </IndexField>
|
---|
46 | <IndexField IFname="repositoryName" index="UN_TOKENIZED" store="YES" termVector="NO">
|
---|
47 | <xsl:value-of select="$REPOSITORYNAME"/>
|
---|
48 | </IndexField>
|
---|
49 | <xsl:for-each select="foxml:objectProperties/foxml:property">
|
---|
50 | <IndexField index="UN_TOKENIZED" store="YES" termVector="NO">
|
---|
51 | <xsl:attribute name="IFname"><xsl:value-of select="concat('object.', substring-after(@NAME,'#'))"/></xsl:attribute>
|
---|
52 | <xsl:value-of select="@VALUE"/>
|
---|
53 | </IndexField>
|
---|
54 | </xsl:for-each>
|
---|
55 |
|
---|
56 | <!--index all datastreamVersions: -->
|
---|
57 | <!--xsl:for-each select="foxml:datastream/foxml:datastreamVersion/foxml:xmlContent/dc:dc/*">
|
---|
58 | <IndexField index="TOKENIZED" store="YES" termVector="YES">
|
---|
59 | <xsl:attribute name="IFname"><xsl:value-of select="concat('dc.', substring-after(name(),':'))"/></xsl:attribute>
|
---|
60 | <xsl:value-of select="text()"/>
|
---|
61 | </IndexField>
|
---|
62 | </xsl:for-each-->
|
---|
63 |
|
---|
64 | <!--index only last datastreamVersion: -->
|
---|
65 | <xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/*">
|
---|
66 | <IndexField index="TOKENIZED" store="YES" termVector="YES">
|
---|
67 | <xsl:attribute name="IFname"><xsl:value-of select="concat('dc.', substring-after(name(),':'))"/></xsl:attribute>
|
---|
68 | <xsl:value-of select="text()"/>
|
---|
69 | </IndexField>
|
---|
70 | </xsl:for-each>
|
---|
71 |
|
---|
72 | <xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/dc:dc/*">
|
---|
73 | <IndexField index="TOKENIZED" store="YES" termVector="YES">
|
---|
74 | <xsl:attribute name="IFname"><xsl:value-of select="concat('dc.', substring-after(name(),':'))"/></xsl:attribute>
|
---|
75 | <xsl:value-of select="text()"/>
|
---|
76 | </IndexField>
|
---|
77 | </xsl:for-each>
|
---|
78 |
|
---|
79 | <xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/*">
|
---|
80 | <IndexField index="UN_TOKENIZED" store="YES" termVector="YES">
|
---|
81 | <xsl:attribute name="IFname"><xsl:value-of select="concat('dc2.', substring-after(name(),':'))"/></xsl:attribute>
|
---|
82 | <xsl:value-of select="text()"/>
|
---|
83 | </IndexField>
|
---|
84 | </xsl:for-each>
|
---|
85 |
|
---|
86 | <xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/dc:dc/*">
|
---|
87 | <IndexField index="UN_TOKENIZED" store="YES" termVector="YES">
|
---|
88 | <xsl:attribute name="IFname"><xsl:value-of select="concat('dc2.', substring-after(name(),':'))"/></xsl:attribute>
|
---|
89 | <xsl:value-of select="text()"/>
|
---|
90 | </IndexField>
|
---|
91 | </xsl:for-each>
|
---|
92 |
|
---|
93 | <xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/mods:mods//*">
|
---|
94 | <IndexField index="TOKENIZED" store="YES" termVector="NO">
|
---|
95 | <xsl:attribute name="IFname"><xsl:value-of select="concat('mods.', substring-after(name(),':'))"/></xsl:attribute>
|
---|
96 | <xsl:value-of select="text()"/>
|
---|
97 | </IndexField>
|
---|
98 | </xsl:for-each>
|
---|
99 |
|
---|
100 |
|
---|
101 | <xsl:for-each select="foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion[last()]/foxml:xmlContent/rdf:RDF/rdf:Description/*">
|
---|
102 | <IndexField index="UN_TOKENIZED" store="YES" termVector="YES">
|
---|
103 | <xsl:attribute name="IFname"><xsl:value-of select="concat('rdf.', translate(name(), ':', '.'))"/></xsl:attribute>
|
---|
104 | <xsl:value-of select="substring-after(@rdf:resource, 'info:fedora/')"/>
|
---|
105 | <xsl:value-of select="text()"/>
|
---|
106 | </IndexField>
|
---|
107 | </xsl:for-each>
|
---|
108 |
|
---|
109 |
|
---|
110 | <xsl:for-each select="foxml:datastream">
|
---|
111 | <IndexField>
|
---|
112 | <xsl:attribute name="IFname">ds.fulltext</xsl:attribute>
|
---|
113 | <xsl:attribute name="dsId"><xsl:value-of select="@ID"/></xsl:attribute>
|
---|
114 | <xsl:attribute name="index">TOKENIZED</xsl:attribute>
|
---|
115 | <xsl:attribute name="store">YES</xsl:attribute>
|
---|
116 | <xsl:attribute name="termVector">NO</xsl:attribute>
|
---|
117 | </IndexField>
|
---|
118 |
|
---|
119 | <IndexField IFname="ds.label" index="TOKENIZED" store="YES" termVector="YES">
|
---|
120 | <xsl:value-of select="foxml:datastreamVersion[last()]/@LABEL"/>
|
---|
121 | </IndexField>
|
---|
122 | </xsl:for-each>
|
---|
123 |
|
---|
124 | </xsl:template>
|
---|
125 |
|
---|
126 | </xsl:stylesheet>
|
---|