avoiding unnecesasary unused namespace declarations in output documents
[idzebra-moved-to-github.git] / test / xslt / index.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/xslt/1"
4   exclude-result-prefixes="m z"
5   version="1.0">
6   <!-- $Id: index.xsl,v 1.6 2007-02-12 13:58:12 marc Exp $ -->
7   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
8   
9
10   <xsl:template match="text()"/>
11
12
13   <xsl:template match="/m:record">
14     <z:record z:id="{normalize-space(m:controlfield[@tag='001'])}"
15         z:rank="{normalize-space(m:rank)}"
16         >
17       <xsl:apply-templates/>
18     </z:record>
19   </xsl:template>
20
21   <xsl:template match="m:controlfield[@tag='001']">
22     <z:index name="control">
23       <xsl:value-of select="."/>
24     </z:index>
25   </xsl:template>
26   
27   <xsl:template match="m:datafield[@tag='245']/m:subfield[@code='a']">
28     <!-- nested. does not have to be! -->
29     <z:index name="title">
30       <z:index name="title" type="p">
31         <xsl:value-of select="."/>
32       </z:index>
33     </z:index>
34
35     <!-- can do. But sort register only supports numeric attributes. -->
36     <z:index name="title" type="s"> 
37       <xsl:value-of select="."/>
38     </z:index>
39
40   </xsl:template>
41
42 </xsl:stylesheet>