Use mode to switch between presentation format brief and indexing.
[idzebra-moved-to-github.git] / test / xslt / marc1.xsl
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2   xmlns:m="http://www.loc.gov/MARC21/slim"
3   xmlns:z="http://indexdata.dk/zebra/indexing/1"
4   version="1.0">
5   <!-- $Id: marc1.xsl,v 1.2 2005-04-28 13:34:05 adam Exp $ -->
6   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
7   
8   <xsl:template match="/">
9     <xsl:choose>
10       <xsl:when test="$schema='http://indexdata.dk/zebra/indexing/1'">
11         <xsl:apply-templates mode="index"/>
12       </xsl:when>
13       <xsl:when test="$schema='brief'">
14         <xsl:apply-templates mode="brief"/>
15       </xsl:when>
16     </xsl:choose>
17   </xsl:template>
18   
19   <xsl:template match="/m:record/m:controlfield[@tag=001]" mode="index">
20     <z:index field="control">
21       <xsl:apply-templates match="."/>
22     </z:index>
23   </xsl:template>
24   
25   <xsl:template match="/m:record/m:datafield[@tag=245]" mode="index">
26     <z:index field="title">
27       <xsl:apply-templates match="."/>
28     </z:index>
29   </xsl:template>
30   
31   <xsl:template match="/m:record/m:datafield[@tag=245]" mode="brief">
32     <title><xsl:value-of select="."/></title>
33   </xsl:template>
34   
35 </xsl:stylesheet>