-
Notifications
You must be signed in to change notification settings - Fork 17
/
QDC_to_solr.xslt
35 lines (31 loc) · 1.21 KB
/
QDC_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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<!-- Match QDC DS with arbitrary root node. -->
<xsl:template match="foxml:datastream[@ID='QDC']/foxml:datastreamVersion[last()]">
<xsl:param name="content"/>
<xsl:param name="prefix">qdc_</xsl:param>
<xsl:param name="suffix">_ms</xsl:param>
<xsl:call-template name="slurp_qdc">
<xsl:with-param name="content" select="$content"/>
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="suffix" select="$suffix"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="slurp_qdc">
<xsl:param name="content"/>
<xsl:param name="prefix">qdc_</xsl:param>
<xsl:param name="suffix">_ms</xsl:param>
<xsl:for-each select="$content/*/*">
<field>
<xsl:attribute name="name">
<xsl:value-of select="concat($prefix, local-name(), $suffix)"/>
</xsl:attribute>
<xsl:value-of select="text()"/>
</field>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>