Add test on type (only if present)
authorDennis Schafroth <dennis@indexdata.com>
Fri, 15 Jul 2011 13:50:48 +0000 (15:50 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Fri, 15 Jul 2011 13:50:48 +0000 (15:50 +0200)
etc/pz2-solr.xsl

index e2e0f04..0b7b796 100644 (file)
     </doc>
   </xsl:template>
   <xsl:template match="pz:metadata">
-    <field>
-      <xsl:attribute  name="name">
-       <xsl:value-of select="@type"/>
-      </xsl:attribute>
+    <xsl:if test="@type">
+      <field>
+       <xsl:attribute  name="name">
+         <xsl:value-of select="@type"/>
+       </xsl:attribute>
        <xsl:value-of select="."/>
-    </field>
+      </field>
+    </xsl:if>
   </xsl:template>
 </xsl:stylesheet>