1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: zeerex2index.xsl,v 1.13 2007-03-29 17:13:45 mike Exp $ -->
3 <!-- See the ZeeRex profile at http://srw.cheshire3.org/profiles/ZeeRex/ -->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:z="http://indexdata.dk/zebra/xslt/1"
6 xmlns:e="http://explain.z3950.org/dtd/2.0/"
7 xmlns:i="http://indexdata.com/irspy/1.0"
9 <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
10 <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
11 <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
12 <!-- Disable all default text node output -->
13 <xsl:template match="text()"/>
14 <!-- Match on ZeeRex XML record -->
15 <xsl:template match="//e:explain">
16 <xsl:variable name="id"><xsl:value-of select="concat(
17 e:serverInfo/e:host, ':',
18 e:serverInfo/e:port, '/',
19 e:serverInfo/e:database)"/></xsl:variable>
20 <z:record id="{$id}" type="update">
22 <!-- Well, not quite _anywhere_. Only textual fields are indexed -->
23 <z:index name="cql:anywhere" type="w">
24 <xsl:value-of select="e:serverInfo/e:host"/>
25 <xsl:text> </xsl:text>
26 <xsl:value-of select="e:serverInfo/e:port"/>
27 <xsl:text> </xsl:text>
28 <xsl:value-of select="e:serverInfo/e:database"/>
29 <xsl:text> </xsl:text>
30 <xsl:value-of select="e:databaseInfo/e:title"/>
31 <xsl:text> </xsl:text>
32 <xsl:value-of select="e:databaseInfo/e:description"/>
33 <xsl:text> </xsl:text>
34 <xsl:value-of select="e:databaseInfo/e:author"/>
37 <z:index name="rec:authorityIndicator" type="0">
38 <xsl:value-of select="@authoritative"/>
41 <z:index name="rec:id" type="u">
42 <xsl:value-of select="$id"/>
46 <z:index name="net:protocol" type="w">
47 <xsl:value-of select="e:serverInfo/@protocol"/>
49 <z:index name="net:version" type="0">
50 <xsl:value-of select="e:serverInfo/@version"/>
52 <z:index name="net:method" type="w">
53 <xsl:value-of select="e:serverInfo/@method"/>
55 <z:index name="net:host" type="0">
56 <xsl:value-of select="e:serverInfo/e:host"/>
58 <z:index name="net:host" type="s">
59 <xsl:value-of select="e:serverInfo/e:host"/>
61 <z:index name="net:port" type="0">
62 <xsl:value-of select="e:serverInfo/e:port"/>
64 <z:index name="net:port" type="s">
65 <xsl:value-of select="e:serverInfo/e:port"/>
67 <z:index name="net:path" type="0">
68 <xsl:value-of select="e:serverInfo/e:database"/>
70 <z:index name="net:path" type="s">
71 <xsl:value-of select="e:serverInfo/e:database"/>
73 <z:index name="dc:date" type="d">
74 <xsl:value-of select="e:serverInfo/e:database/@lastUpdate"/>
76 <z:index name="zeerex:numberOfRecords" type="n">
77 <xsl:value-of select="e:serverInfo/e:database/@numRecs"/>
81 <z:index name="dc:title" type="w">
82 <xsl:value-of select="e:databaseInfo/e:title"/>
84 <z:index name="dc:title" type="s">
85 <xsl:value-of select="e:databaseInfo/e:title"/>
87 <z:index name="dc:description" type="w">
88 <xsl:value-of select="e:databaseInfo/e:description"/>
90 <z:index name="dc:creator" type="w">
91 <xsl:value-of select="e:databaseInfo/e:author"/>
93 <z:index name="dc:creator" type="s">
94 <xsl:value-of select="e:databaseInfo/e:author"/>
96 <z:index name="dc:language" type="w">
97 <xsl:value-of select="e:databaseInfo/e:langUsage"/>
101 <z:index name="rec:lastModificationDate" type="d">
102 <!-- ### Can Zebra handle this ISO-format date? -->
103 <xsl:value-of select="e:metaInfo/e:dateModified"/>
106 <!-- ### indexInfo -->
109 <z:index name="zeerex:recordSyntax" type="0">
110 <xsl:value-of select="e:recordInfo/e:recordSyntax/@name"/>
111 <!-- ### But @identifier is an OID for Z39.50 -->
115 <z:index name="zeerex:schema" type="0">
116 <xsl:value-of select="e:schemaInfo/e:schema/@identifier"/>
117 <!-- ### Really? Identifier? -->
120 <!-- supportsInfo -->
121 <xsl:for-each select="e:configInfo/e:supports[@type='relationModifier']">
122 <z:index name="zeerex:supports_relationModifier" type="0">
123 <xsl:value-of select="."/>
126 <xsl:for-each select="e:configInfo/e:supports[@type='booleanModifier']">
127 <z:index name="zeerex:supports_booleanModifier" type="0">
128 <xsl:value-of select="."/>
131 <xsl:for-each select="e:configInfo/e:supports[@type='maskingCharacter']">
132 <z:index name="zeerex:supports_maskingCharacter" type="0">
133 <xsl:value-of select="."/>
136 <!-- Many more could be added as required -->
139 <z:index name="zeerex:libType" type="0">
140 <xsl:value-of select="i:status/i:libraryType"/>
142 <z:index name="zeerex:country" type="0">
143 <xsl:value-of select="i:status/i:country"/>