Omit CVS Id. Update copyright year.
[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   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
7   
8
9   <xsl:template match="text()"/>
10
11
12   <xsl:template match="/m:record">
13     <z:record z:id="{normalize-space(m:controlfield[@tag='001'])}"
14         z:rank="{normalize-space(m:rank)}"
15         >
16       <xsl:apply-templates/>
17     </z:record>
18   </xsl:template>
19
20   <xsl:template match="m:controlfield[@tag='001']">
21     <z:index name="control">
22       <xsl:value-of select="normalize-space(.)"/>
23     </z:index>
24   </xsl:template>
25   
26   <xsl:template match="m:datafield[@tag='245']/m:subfield[@code='a']">
27     <!-- nested. does not have to be! -->
28     <z:index name="title">
29       <z:index name="title" type="p">
30         <xsl:value-of select="."/>
31       </z:index>
32     </z:index>
33
34     <!-- can do. But sort register only supports numeric attributes. -->
35     <z:index name="title" type="s"> 
36       <xsl:value-of select="."/>
37     </z:index>
38
39   </xsl:template>
40
41 </xsl:stylesheet>