Bug 15597: Typo in opac-auth-detail.tt
[koha.git] / etc / pazpar2 / pz2-ourl-base.xsl
blob260dc9f760d63ba64b44827e600dea6efa06e8ce
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet
3 version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
6 xmlns:marc="http://www.loc.gov/MARC21/slim"
7 xmlns:str="http://exslt.org/strings"
8 extension-element-prefixes="str">
10 <xsl:param name="open_url_resolver"/>
11 <!--<xsl:variable name="resolver">http://zeus.lib.uoc.gr:3210/sfxtst3</xsl:variable>-->
13 <xsl:template name="insert-md-openurl">
15 <xsl:value-of select="$open_url_resolver" /><xsl:text>?generatedby=pz2</xsl:text>
16 <xsl:call-template name="ou-parse-author" />
17 <xsl:call-template name="ou-parse-date" />
18 <xsl:call-template name="ou-parse-volume" />
19 <xsl:call-template name="ou-parse-any">
20 <xsl:with-param name="field_name" select="string('isbn')" />
21 </xsl:call-template>
22 <xsl:call-template name="ou-parse-any">
23 <xsl:with-param name="field_name" select="string('issn')" />
24 </xsl:call-template>
25 <xsl:call-template name="ou-parse-any">
26 <xsl:with-param name="field_name" select="string('title')" />
27 </xsl:call-template>
28 <xsl:call-template name="ou-parse-any">
29 <xsl:with-param name="field_name" select="string('atitle')" />
30 </xsl:call-template>
32 </xsl:template>
34 <!-- parsing raw string data -->
36 <xsl:template name="ou-parse-author" >
37 <xsl:variable name="author">
38 <xsl:call-template name="ou-author" />
39 </xsl:variable>
41 <xsl:variable name="aulast" select="normalize-space(substring-before($author, ','))"/>
43 <xsl:variable name="aufirst"
44 select="substring-before( normalize-space(substring-after($author, ',')), ' ')"/>
46 <xsl:if test="$aulast != ''">
47 <xsl:text>&amp;aulast=</xsl:text>
48 <xsl:value-of select="$aulast" />
49 </xsl:if>
51 <xsl:if test="string-length( translate($aufirst, '.', '') ) &gt; 1" >
52 <xsl:text>&amp;aufirst=</xsl:text>
53 <xsl:value-of select="$aufirst" />
54 </xsl:if>
56 </xsl:template>
58 <xsl:template name="ou-parse-volume">
59 <xsl:variable name="volume">
60 <xsl:call-template name="ou-volume" />
61 </xsl:variable>
63 <xsl:variable name="vol" select="substring-after($volume, 'Vol')"/>
64 <xsl:variable name="issue" select="false()" />
65 <xsl:variable name="spage" select="false()" />
67 <xsl:if test="$vol">
68 <xsl:text>&amp;volume=</xsl:text>
69 <xsl:value-of select="$vol" />
70 </xsl:if>
72 <xsl:if test="$issue">
73 <xsl:text>&amp;issue=</xsl:text>
74 <xsl:value-of select="$issue" />
75 </xsl:if>
77 <xsl:if test="$spage">
78 <xsl:text>&amp;spage=</xsl:text>
79 <xsl:value-of select="$vol" />
80 </xsl:if>
82 </xsl:template>
85 <xsl:template name="ou-parse-date">
86 <xsl:variable name="date">
87 <xsl:call-template name="ou-date" />
88 </xsl:variable>
90 <xsl:variable name="parsed_date" select="translate($date, '.[]c;', '')"/>
92 <xsl:if test="$parsed_date">
93 <xsl:text>&amp;date=</xsl:text>
94 <xsl:value-of select="$parsed_date" />
95 </xsl:if>
97 </xsl:template>
100 <xsl:template name="ou-parse-any">
101 <xsl:param name="field_name" />
103 <xsl:variable name="field_value">
104 <xsl:choose>
106 <xsl:when test="$field_name = 'isbn'">
107 <xsl:call-template name="ou-isbn"/>
108 </xsl:when>
110 <xsl:when test="$field_name = 'issn'">
111 <xsl:call-template name="ou-issn"/>
112 </xsl:when>
114 <xsl:when test="$field_name = 'atitle'">
115 <xsl:call-template name="ou-atitle"/>
116 </xsl:when>
118 <xsl:when test="$field_name = 'title'">
119 <xsl:call-template name="ou-title"/>
120 </xsl:when>
122 </xsl:choose>
123 </xsl:variable>
125 <xsl:variable name="digits" select="1234567890"/>
127 <xsl:variable name="parsed_value">
128 <xsl:choose>
130 <xsl:when test="$field_name = 'isbn'">
131 <xsl:value-of select="translate($field_value, translate($field_value, concat($digits, 'X'), ''), '')"/>
132 </xsl:when>
134 <xsl:when test="$field_name = 'issn'">
135 <xsl:value-of select="translate($field_value, translate($field_value, concat($digits, '-', 'X'), ''), '')"/>
136 </xsl:when>
138 <xsl:when test="$field_name = 'atitle'">
139 <xsl:value-of select="translate(normalize-space($field_value), '.', '')"/>
140 </xsl:when>
142 <xsl:when test="$field_name = 'title'">
143 <xsl:value-of select="translate(normalize-space($field_value), '.', '')"/>
144 </xsl:when>
146 </xsl:choose>
147 </xsl:variable>
150 <xsl:if test="$parsed_value != ''">
151 <xsl:text>&amp;</xsl:text>
152 <xsl:value-of select="$field_name" />
153 <xsl:text>=</xsl:text>
154 <xsl:value-of select="$parsed_value" />
155 </xsl:if>
157 </xsl:template>
160 </xsl:stylesheet>
161 <!--
163 * Local variables:
164 * c-basic-offset: 2
165 * indent-tabs-mode: nil
166 * End:
167 * vim: shiftwidth=2 tabstop=4 expandtab