forked from discoverygarden/islandora_transforms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEI_to_solr.xslt
executable file
·63 lines (56 loc) · 2.07 KB
/
TEI_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
<?xml version="1.0" encoding="UTF-8"?>
<!-- TEI -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:tei="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="tei foxml">
<xsl:template match="foxml:datastream[@ID='TEI']/foxml:datastreamVersion[last()]" name="index_TEI">
<xsl:param name="content"/>
<xsl:param name="prefix">TEI_</xsl:param>
<xsl:param name="suffix">_ms</xsl:param>
<!-- surname -->
<xsl:for-each select="$content//tei:surname[text()]">
<field>
<xsl:attribute name="name">
<xsl:value-of select="concat($prefix, 'surname', $suffix)"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(text())"/>
</field>
</xsl:for-each>
<!-- place name -->
<xsl:for-each select="$content//tei:placeName/*[text()]">
<field>
<xsl:attribute name="name">
<xsl:value-of select="concat($prefix, 'placeName', $suffix)"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(text())"/>
</field>
</xsl:for-each>
<!-- organization name -->
<xsl:for-each select="$content//tei:orgName[text()]">
<field>
<xsl:attribute name="name">
<xsl:value-of select="concat($prefix, 'orgName', $suffix)"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(text())"/>
</field>
</xsl:for-each>
<!-- text -->
<xsl:for-each select="$content//tei:text[text()]">
<field>
<xsl:attribute name="name">
<xsl:value-of select="concat($prefix, 'text', $suffix)"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(.)"/>
</field>
</xsl:for-each>
<!-- body -->
<xsl:for-each select="$content//tei:text/tei:body[text()]">
<field>
<xsl:attribute name="name">
<xsl:value-of select="concat($prefix, 'body', $suffix)"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(.)"/>
</field>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>