Do not return TEST_BAD when diagnostic is 1 (permanent system error).
[irspy-moved-to-github.git] / xsl / irspy2zeerex.xsl
index 6ac8cd2..3926ad6 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version="1.0"?>
 <!--
-    $Id: irspy2zeerex.xsl,v 1.19 2007-03-30 17:17:44 sondberg Exp $
 
     This stylesheet is used by IRSpy to map the internal mixed Zeerex/IRSpy
     record format into the Zeerex record which we store.
@@ -73,7 +72,8 @@
 
         <!-- If not, insert what we already had... -->
         <xsl:otherwise>
-          <xsl:copy-of select="explain:indexInfo/*"/>
+          <xsl:copy-of
+                select="explain:indexInfo/explain:index[@search='true']"/>
         </xsl:otherwise>
       </xsl:choose>
     </indexInfo>
                     select="*/irspy:serverImplementationVersion"/>
         <xsl:with-param name="what" select="'serverImplementationVersion'"/>
       </xsl:call-template>
+
+      <xsl:call-template name="insert-latest-nodes">
+        <xsl:with-param name="nodes" select="*/irspy:multiple_opac"/>
+        <xsl:with-param name="what" select="'multiple_opac'"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="insert-latest-nodes">
+        <xsl:with-param name="nodes" select="*/irspy:piggyback"/>
+        <xsl:with-param name="what" select="'piggyback'"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="insert-latest-nodes">
+        <xsl:with-param name="nodes" select="*/irspy:search_bath"/>
+        <xsl:with-param name="what" select="'search_bath'"/>
+      </xsl:call-template>
     </irspy:status>
   </xsl:template>
 
     <xsl:param name="what" select="'unspecified'"/>
     <xsl:param name="i" select="count(*/irspy:probe[@ok='1'])"/>
     <xsl:variable name="date"
-        select="*/irspy:probe[@ok='1' and position() = $i]"/>
+        select="*/irspy:probe[@ok='1'][$i]"/>
     <xsl:variable name="latest"
-        select="$nodes[irspy:strcmp(text(), $date) > 0]"/>
+        select="$nodes[irspy:strcmp(text(), $date) >= 0]"/>
 
     <xsl:choose>
       <xsl:when test="$latest">
         <xsl:copy-of select="$latest"/>
       </xsl:when>
+      <!-- <xsl:when test="$i > 0 and $i &lt; 200"> -->
       <xsl:when test="$i > 0">
         <xsl:call-template name="insert-latest-nodes">
           <xsl:with-param name="what" select="$what"/>
       </xsl:call-template>
     </xsl:param>
 
-    <index>
-      <xsl:attribute name="search">
-        <xsl:choose>
-          <xsl:when test="$update/@ok = 1">true</xsl:when>
-          <xsl:otherwise>false</xsl:otherwise>
-        </xsl:choose>
-      </xsl:attribute>
-      <title primary="true" lang="en">
-        <xsl:value-of select="$title"/>
-      </title>
-      <map primary="true">
-        <attr type="1" set="{$update/@set}">
-          <xsl:value-of select="$update/@ap"/>
-        </attr>
-      </map>
-    </index>
+    <xsl:if test="$update/@ok = 1">
+      <index search="true">
+        <title primary="true" lang="en"><xsl:value-of select="$title"/></title>
+        <map primary="true">
+          <attr type="1" set="{$update/@set}">
+            <xsl:value-of select="$update/@ap"/>
+          </attr>
+        </map>
+      </index>
+    </xsl:if>
   </xsl:template>