Use mode to switch between presentation format brief and indexing.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 28 Apr 2005 13:34:05 +0000 (13:34 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 28 Apr 2005 13:34:05 +0000 (13:34 +0000)
test/xslt/marc1.xsl

index 87d4e4c..467fa6a 100644 (file)
@@ -1,23 +1,35 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:m="http://www.loc.gov/MARC21/slim"
- xmlns:z="http://indexdata.dk/zebra/indexing/1"
- version="1.0">
-
-<xsl:output indent="yes"
-      method="xml"
-      version="1.0"
-      encoding="UTF-8"/>
-
-     <xsl:template match="/m:record/m:controlfield[@tag=001]">
-       <z:index field="control">
-         <xsl:apply-templates match="."/>
-       </z:index>
-     </xsl:template>
-     <xsl:template match="/m:record/m:datafield[@tag=245]">
-       <z:index field="title">
-         <xsl:apply-templates match="."/>
-       </z:index>
-     </xsl:template>
+  xmlns:m="http://www.loc.gov/MARC21/slim"
+  xmlns:z="http://indexdata.dk/zebra/indexing/1"
+  version="1.0">
+  <!-- $Id: marc1.xsl,v 1.2 2005-04-28 13:34:05 adam Exp $ -->
+  <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+  
+  <xsl:template match="/">
+    <xsl:choose>
+      <xsl:when test="$schema='http://indexdata.dk/zebra/indexing/1'">
+       <xsl:apply-templates mode="index"/>
+      </xsl:when>
+      <xsl:when test="$schema='brief'">
+       <xsl:apply-templates mode="brief"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="/m:record/m:controlfield[@tag=001]" mode="index">
+    <z:index field="control">
+      <xsl:apply-templates match="."/>
+    </z:index>
+  </xsl:template>
+  
+  <xsl:template match="/m:record/m:datafield[@tag=245]" mode="index">
+    <z:index field="title">
+      <xsl:apply-templates match="."/>
+    </z:index>
+  </xsl:template>
+  
+  <xsl:template match="/m:record/m:datafield[@tag=245]" mode="brief">
+    <title><xsl:value-of select="."/></title>
+  </xsl:template>
+  
 </xsl:stylesheet>