1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!-- expects AGService XML records -->
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pz="http://www.indexdata.com/pazpar2/1.0" version="1.0">
5 <xsl:template name="first-6-chars">
6 <xsl:param name="subfield-value"/>
7 <xsl:value-of select="substring($subfield-value,1,6)"/>
9 <xsl:template name="first-4-digits">
10 <xsl:param name="subfield-value"/>
11 <xsl:value-of select="substring(translate($subfield-value, translate($subfield-value,'0123456789', ''), ''),1,4)"/>
14 <xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/>
16 <xsl:template name="medium">
17 <!-- Default medium template that may be overridden from the init doc. -->
18 <!-- display-medium from Illuminar -->
20 <xsl:when test="MarcLeader">
21 <!-- strings in xslt are 1-indexed -->
22 <xsl:variable name="ldr06" select="substring(MarcLeader, 7, 1)" />
23 <xsl:variable name="ldr07" select="substring(MarcLeader, 8, 1)" />
24 <xsl:variable name="ldr08" select="substring(MarcLeader, 9, 1)" />
26 <xsl:when test="$ldr06 = 'c'">
27 <xsl:text>Notated music</xsl:text>
29 <xsl:when test="$ldr06 = 'd'">
30 <xsl:text>Manuscript notated music</xsl:text>
32 <xsl:when test="$ldr06 = 'e'">
33 <xsl:text>Cartographic material</xsl:text>
35 <xsl:when test="$ldr06 = 'f'">
36 <xsl:text>Manuscript cartographic material</xsl:text>
38 <xsl:when test="$ldr06 = 'g'">
39 <xsl:text>Projected medium</xsl:text>
41 <xsl:when test="$ldr06 = 'i'">
42 <xsl:text>Nonmusical sound recording</xsl:text>
44 <xsl:when test="$ldr06 = 'j'">
45 <xsl:text>Musical sound recording</xsl:text>
47 <xsl:when test="$ldr06 = 'k'">
48 <xsl:text>Two-dimensional nonprojectable graphic</xsl:text>
50 <xsl:when test="$ldr06 = 'm'">
51 <xsl:text>Computer file</xsl:text>
53 <xsl:when test="$ldr06 = 'o'">
54 <xsl:text>Kit</xsl:text>
56 <xsl:when test="$ldr06 = 'p'">
57 <xsl:text>Mixed materials</xsl:text>
59 <xsl:when test="$ldr06 = 'r'">
60 <xsl:text>Visual materials</xsl:text>
62 <xsl:when test="$ldr07 = 'b' or $ldr07 = 's'">
63 <xsl:text>Serial</xsl:text>
65 <!-- by default a book -->
67 <xsl:text>Book</xsl:text>
72 <xsl:text>xml records</xsl:text>
77 <xsl:template match="Results">
79 <xsl:apply-templates/>
83 <xsl:template match="Result">
84 <xsl:variable name="medium">
85 <xsl:call-template name="medium"/>
89 <pz:metadata type="medium">
90 <xsl:call-template name="medium"/>
92 <xsl:for-each select="Title">
93 <pz:metadata type="title">
95 <xsl:when test="position()=1">
96 <xsl:value-of select="."/>
99 <xsl:value-of select="concat(' ',.)"/>
104 <xsl:for-each select="Author">
105 <pz:metadata type="author">
107 <xsl:when test="position()=1">
108 <xsl:value-of select="."/>
111 <xsl:value-of select="concat(' ',.)"/>
116 <xsl:for-each select="Subject">
117 <pz:metadata type="subject">
119 <xsl:when test="position()=1">
120 <xsl:value-of select="."/>
123 <xsl:value-of select="concat(' ',.)"/>
128 <xsl:for-each select="PubYear">
129 <pz:metadata type="date">
131 <xsl:when test="position()=1">
132 <xsl:value-of select="."/>
135 <xsl:value-of select="concat(' ',.)"/>
141 <xsl:when test="$medium = 'books'">
142 <xsl:for-each select="Title">
143 <pz:metadata type="brief-2">
145 <xsl:when test="position()=1">
146 <xsl:value-of select="."/>
149 <xsl:value-of select="concat(' ',.)"/>
154 <xsl:for-each select="Author">
155 <pz:metadata type="brief-3">
157 <xsl:when test="position()=1">
158 <xsl:value-of select="."/>
161 <xsl:value-of select="concat(' ',.)"/>
172 <xsl:template match="text()"/>