XSLT filter reads z:record construct which may define record ID
[idzebra-moved-to-github.git] / test / xslt / index.xsl
index 01eb4ac..ccdec83 100644 (file)
@@ -2,19 +2,31 @@
   xmlns:m="http://www.loc.gov/MARC21/slim"
   xmlns:z="http://indexdata.dk/zebra/xslt/1"
   version="1.0">
-  <!-- $Id: index.xsl,v 1.3 2005-06-15 15:30:05 adam Exp $ -->
+  <!-- $Id: index.xsl,v 1.4 2005-06-24 13:45:54 adam Exp $ -->
   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
   
-  <xsl:template match="/m:record/m:controlfield[@tag=001]">
+
+  <xsl:template match="text()"/>
+
+
+  <xsl:template match="/m:record">
+    <z:record id="{normalize-space(m:controlfield[@tag='001'])}">
+      <xsl:apply-templates/>
+    </z:record>
+  </xsl:template>
+
+  <xsl:template match="m:controlfield[@tag='001']">
     <z:index name="control">
-      <xsl:apply-templates match="."/>
+      <xsl:value-of select="."/>
     </z:index>
   </xsl:template>
   
-  <xsl:template match="/m:record/m:datafield[@tag=245]">
+  <xsl:template match="m:datafield[@tag='245']/m:subfield[@code='a']">
     <z:index name="title">
-      <xsl:apply-templates match="."/>
+      <xsl:value-of select="."/>
     </z:index>
   </xsl:template>
   
+
+
 </xsl:stylesheet>