--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
+ xmlns:marc="http://www.loc.gov/MARC21/slim"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str">
+
+ <xsl:variable name="resolver">http://zeus.lib.uoc.gr:3210/sfxtst3</xsl:variable>
+
+ <xsl:template name="insert-md-openurl">
+
+ <xsl:value-of select="$resolver" /><xsl:text>?generatedby=pz2</xsl:text>
+ <xsl:call-template name="ou-parse-author" />
+ <xsl:call-template name="ou-parse-date" />
+ <xsl:call-template name="ou-parse-volume" />
+ <xsl:call-template name="ou-parse-any">
+ <xsl:with-param name="field_name" select="string('isbn')" />
+ </xsl:call-template>
+ <xsl:call-template name="ou-parse-any">
+ <xsl:with-param name="field_name" select="string('issn')" />
+ </xsl:call-template>
+ <xsl:call-template name="ou-parse-any">
+ <xsl:with-param name="field_name" select="string('title')" />
+ </xsl:call-template>
+ <xsl:call-template name="ou-parse-any">
+ <xsl:with-param name="field_name" select="string('atitle')" />
+ </xsl:call-template>
+
+ </xsl:template>
+
+ <!-- parsing raw string data -->
+
+ <xsl:template name="ou-parse-author" >
+ <xsl:variable name="author">
+ <xsl:call-template name="ou-author" />
+ </xsl:variable>
+
+ <xsl:variable name="aulast" select="normalize-space(substring-before($author, ','))"/>
+
+ <xsl:variable name="aufirst"
+ select="substring-before( normalize-space(substring-after($author, ',')), ' ')"/>
+
+ <xsl:if test="$aulast != ''">
+ <xsl:text>&aulast=</xsl:text>
+ <xsl:value-of select="$aulast" />
+ </xsl:if>
+
+ <xsl:if test="string-length( translate($aufirst, '.', '') ) > 1" >
+ <xsl:text>&aufirst=</xsl:text>
+ <xsl:value-of select="$aufirst" />
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template name="ou-parse-volume">
+ <xsl:variable name="volume">
+ <xsl:call-template name="ou-volume" />
+ </xsl:variable>
+
+ <xsl:variable name="vol" select="substring-after($volume, 'Vol')"/>
+ <xsl:variable name="issue" select="false()" />
+ <xsl:variable name="spage" select="false()" />
+
+ <xsl:if test="$vol">
+ <xsl:text>&volume=</xsl:text>
+ <xsl:value-of select="$vol" />
+ </xsl:if>
+
+ <xsl:if test="$issue">
+ <xsl:text>&issue=</xsl:text>
+ <xsl:value-of select="$issue" />
+ </xsl:if>
+
+ <xsl:if test="$spage">
+ <xsl:text>&spage=</xsl:text>
+ <xsl:value-of select="$vol" />
+ </xsl:if>
+
+ </xsl:template>
+
+
+ <xsl:template name="ou-parse-date">
+ <xsl:variable name="date">
+ <xsl:call-template name="ou-date" />
+ </xsl:variable>
+
+ <xsl:variable name="parsed_date" select="translate($date, '.[]c;', '')"/>
+
+ <xsl:if test="$parsed_date">
+ <xsl:text>&date=</xsl:text>
+ <xsl:value-of select="$parsed_date" />
+ </xsl:if>
+
+ </xsl:template>
+
+
+ <xsl:template name="ou-parse-any">
+ <xsl:param name="field_name" />
+
+ <xsl:variable name="field_value">
+ <xsl:choose>
+
+ <xsl:when test="$field_name = 'isbn'">
+ <xsl:call-template name="ou-isbn"/>
+ </xsl:when>
+
+ <xsl:when test="$field_name = 'issn'">
+ <xsl:call-template name="ou-issn"/>
+ </xsl:when>
+
+ <xsl:when test="$field_name = 'atitle'">
+ <xsl:call-template name="ou-atitle"/>
+ </xsl:when>
+
+ <xsl:when test="$field_name = 'title'">
+ <xsl:call-template name="ou-title"/>
+ </xsl:when>
+
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="digits" select="1234567890"/>
+
+ <xsl:variable name="parsed_value">
+ <xsl:choose>
+
+ <xsl:when test="$field_name = 'isbn'">
+ <xsl:value-of select="translate($field_value, translate($field_value, concat($digits, 'X'), ''), '')"/>
+ </xsl:when>
+
+ <xsl:when test="$field_name = 'issn'">
+ <xsl:value-of select="translate($field_value, translate($field_value, concat($digits, '-', 'X'), ''), '')"/>
+ </xsl:when>
+
+ <xsl:when test="$field_name = 'atitle'">
+ <xsl:value-of select="translate(normalize-space($field_value), '.', '')"/>
+ </xsl:when>
+
+ <xsl:when test="$field_name = 'title'">
+ <xsl:value-of select="translate(normalize-space($field_value), '.', '')"/>
+ </xsl:when>
+
+ </xsl:choose>
+ </xsl:variable>
+
+
+ <xsl:if test="$parsed_value != ''">
+ <xsl:text>&</xsl:text>
+ <xsl:value-of select="$field_name" />
+ <xsl:text>=</xsl:text>
+ <xsl:value-of select="$parsed_value" />
+ </xsl:if>
+
+ </xsl:template>
+
+
+</xsl:stylesheet>
+<!--
+/*
+ * Local variables:
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=2 tabstop=4 expandtab
+ */
+-->
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
+ xmlns:marc="http://www.loc.gov/MARC21/slim"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str">
+
+ <xsl:import href="pz2-ourl-base.xsl"/>
+
+ <xsl:template name="ou-author" >
+ <!-- what to do with multiple authors??-->
+ <xsl:for-each select="marc:datafield[@tag='100' or @tag='700']">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="ou-title" >
+ <!-- if 773 exists its a journal/article -->
+ <xsl:choose>
+
+ <xsl:when test="marc:datafield[@tag='773']/marc:subfield[@code='t']">
+ <xsl:value-of select="marc:datafield[@tag='773']/marc:subfield[@code='t']"/>
+ </xsl:when>
+
+ <xsl:when test="marc:datafield[@tag='245']/marc:subfield[@code='a']">
+ <xsl:value-of select="marc:datafield[@tag='245']/marc:subfield[@code='a']"/>
+ </xsl:when>
+
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="ou-atitle" >
+ <!-- return value only if article or journal -->
+ <xsl:if test="marc:datafield[@tag='773']">
+ <xsl:value-of select="marc:datafield[@tag='245']/marc:subfield[@code='a']"/>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="ou-date" >
+ <xsl:for-each select="marc:datafield[@tag='260']">
+ <xsl:value-of select="marc:subfield[@code='c']"/>
+ </xsl:for-each>
+ </xsl:template>
+
+
+ <xsl:template name="ou-isbn" >
+ <!-- if 773 exists its a journal/article -->
+ <xsl:choose>
+
+ <xsl:when test="marc:datafield[@tag='773']/marc:subfield[@code='z']">
+ <xsl:value-of select="marc:datafield[@tag='773']/marc:subfield[@code='z']"/>
+ </xsl:when>
+
+ <xsl:when test="marc:datafield[@tag='020']/marc:subfield[@code='a']">
+ <xsl:value-of select="marc:datafield[@tag='020']/marc:subfield[@code='a']"/>
+ </xsl:when>
+
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="ou-issn" >
+ <!-- if 773 exists its a journal/article -->
+ <xsl:choose>
+
+ <xsl:when test="marc:datafield[@tag='773']/marc:subfield[@code='x']">
+ <xsl:value-of select="marc:datafield[@tag='773']/marc:subfield[@code='x']"/>
+ </xsl:when>
+
+ <xsl:when test="marc:datafield[@tag='022']/marc:subfield[@code='a']">
+ <xsl:value-of select="marc:datafield[@tag='022']/marc:subfield[@code='a']"/>
+ </xsl:when>
+
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="ou-volume" >
+ <xsl:if test="marc:datafield[@tag='773']">
+ <xsl:value-of select="marc:datafield[@tag='773']/marc:subfield[@code='g']"/>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
+<!--
+/*
+ * Local variables:
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=2 tabstop=4 expandtab
+ */
+-->