1 <?xml version="1.0" encoding="UTF-8"?>
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')" />
22 <xsl:call-template name="ou-parse-any">
23 <xsl:with-param name="field_name" select="string('issn')" />
25 <xsl:call-template name="ou-parse-any">
26 <xsl:with-param name="field_name" select="string('title')" />
28 <xsl:call-template name="ou-parse-any">
29 <xsl:with-param name="field_name" select="string('atitle')" />
34 <!-- parsing raw string data -->
36 <xsl:template name="ou-parse-author" >
37 <xsl:variable name="author">
38 <xsl:call-template name="ou-author" />
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>&aulast=</xsl:text>
48 <xsl:value-of select="$aulast" />
51 <xsl:if test="string-length( translate($aufirst, '.', '') ) > 1" >
52 <xsl:text>&aufirst=</xsl:text>
53 <xsl:value-of select="$aufirst" />
58 <xsl:template name="ou-parse-volume">
59 <xsl:variable name="volume">
60 <xsl:call-template name="ou-volume" />
63 <xsl:variable name="vol" select="substring-after($volume, 'Vol')"/>
64 <xsl:variable name="issue" select="false()" />
65 <xsl:variable name="spage" select="false()" />
68 <xsl:text>&volume=</xsl:text>
69 <xsl:value-of select="$vol" />
72 <xsl:if test="$issue">
73 <xsl:text>&issue=</xsl:text>
74 <xsl:value-of select="$issue" />
77 <xsl:if test="$spage">
78 <xsl:text>&spage=</xsl:text>
79 <xsl:value-of select="$vol" />
85 <xsl:template name="ou-parse-date">
86 <xsl:variable name="date">
87 <xsl:call-template name="ou-date" />
90 <xsl:variable name="parsed_date" select="translate($date, '.[]c;', '')"/>
92 <xsl:if test="$parsed_date">
93 <xsl:text>&date=</xsl:text>
94 <xsl:value-of select="$parsed_date" />
100 <xsl:template name="ou-parse-any">
101 <xsl:param name="field_name" />
103 <xsl:variable name="field_value">
106 <xsl:when test="$field_name = 'isbn'">
107 <xsl:call-template name="ou-isbn"/>
110 <xsl:when test="$field_name = 'issn'">
111 <xsl:call-template name="ou-issn"/>
114 <xsl:when test="$field_name = 'atitle'">
115 <xsl:call-template name="ou-atitle"/>
118 <xsl:when test="$field_name = 'title'">
119 <xsl:call-template name="ou-title"/>
125 <xsl:variable name="digits" select="1234567890"/>
127 <xsl:variable name="parsed_value">
130 <xsl:when test="$field_name = 'isbn'">
131 <xsl:value-of select="translate($field_value, translate($field_value, concat($digits, 'X'), ''), '')"/>
134 <xsl:when test="$field_name = 'issn'">
135 <xsl:value-of select="translate($field_value, translate($field_value, concat($digits, '-', 'X'), ''), '')"/>
138 <xsl:when test="$field_name = 'atitle'">
139 <xsl:value-of select="translate(normalize-space($field_value), '.', '')"/>
142 <xsl:when test="$field_name = 'title'">
143 <xsl:value-of select="translate(normalize-space($field_value), '.', '')"/>
150 <xsl:if test="$parsed_value != ''">
151 <xsl:text>&</xsl:text>
152 <xsl:value-of select="$field_name" />
153 <xsl:text>=</xsl:text>
154 <xsl:value-of select="$parsed_value" />
165 * indent-tabs-mode: nil
167 * vim: shiftwidth=2 tabstop=4 expandtab