Record IDs (and the rec:id index) now case-insensitive.
authorMike Taylor <mike@indexdata.com>
Fri, 2 Mar 2007 11:04:10 +0000 (11:04 +0000)
committerMike Taylor <mike@indexdata.com>
Fri, 2 Mar 2007 11:04:10 +0000 (11:04 +0000)
zebra/zeerex2index.xsl

index 17bf469..925a971 100644 (file)
@@ -1,20 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: zeerex2index.xsl,v 1.9 2007-02-28 17:51:31 mike Exp $ -->
+<!-- $Id: zeerex2index.xsl,v 1.10 2007-03-02 11:04:10 mike Exp $ -->
 <!-- See the ZeeRex profile at http://srw.cheshire3.org/profiles/ZeeRex/ -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:z="http://indexdata.dk/zebra/xslt/1"
                 xmlns:e="http://explain.z3950.org/dtd/2.0/"
                 version="1.0">
+ <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+ <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
  <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
  <!-- Disable all default text node output -->
  <xsl:template match="text()"/>
  <!-- Match on ZeeRex XML record -->
  <xsl:template match="//e:explain">
-  <z:record id="{concat(
-               e:serverInfo/e:host, ':',
-               e:serverInfo/e:port, '/',
-               e:serverInfo/e:database)}"
-           type="update">
+  <xsl:variable name="id"><xsl:value-of select="translate(concat(
+       e:serverInfo/e:host, ':',
+       e:serverInfo/e:port, '/',
+       e:serverInfo/e:database), $ucletters, $lcletters)"/></xsl:variable>
+  <z:record id="{$id}" type="update">
 
    <!-- Well, not quite _anywhere_.  Only textual fields are indexed -->
    <z:index name="cql:anywhere" type="w">
    </z:index>
 
    <z:index name="rec:id" type="0">
-    <xsl:value-of select="concat(
-                         e:serverInfo/e:host, ':',
-                         e:serverInfo/e:port, '/',
-                         e:serverInfo/e:database)"/>
+    <xsl:value-of select="$id"/>
    </z:index>
 
    <!-- serverInfo -->