-<?xml version='1.0'?>\r
-<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\r
- <xsl:template name="datafield">\r
- <xsl:param name="tag"/>\r
- <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>\r
- <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>\r
- <xsl:param name="subfields"/>\r
- <xsl:element name="datafield">\r
- <xsl:attribute name="tag">\r
- <xsl:value-of select="$tag"/>\r
- </xsl:attribute>\r
- <xsl:attribute name="ind1">\r
- <xsl:value-of select="$ind1"/>\r
- </xsl:attribute>\r
- <xsl:attribute name="ind2">\r
- <xsl:value-of select="$ind2"/>\r
- </xsl:attribute>\r
- <xsl:copy-of select="$subfields"/>\r
- </xsl:element>\r
- </xsl:template>\r
-\r
- <xsl:template name="subfieldSelect">\r
- <xsl:param name="codes"/>\r
- <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>\r
- <xsl:variable name="str">\r
- <xsl:for-each select="marc:subfield">\r
- <xsl:if test="contains($codes, @code)">\r
- <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>\r
- </xsl:if>\r
- </xsl:for-each>\r
- </xsl:variable>\r
- <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>\r
- </xsl:template>\r
-\r
- <xsl:template name="buildSpaces">\r
- <xsl:param name="spaces"/>\r
- <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>\r
- <xsl:if test="$spaces>0">\r
- <xsl:value-of select="$char"/>\r
- <xsl:call-template name="buildSpaces">\r
- <xsl:with-param name="spaces" select="$spaces - 1"/>\r
- <xsl:with-param name="char" select="$char"/>\r
- </xsl:call-template>\r
- </xsl:if>\r
- </xsl:template>\r
-\r
- <xsl:template name="chopPunctuation">\r
- <xsl:param name="chopString"/>\r
- <xsl:variable name="length" select="string-length($chopString)"/>\r
- <xsl:choose>\r
- <xsl:when test="$length=0"/>\r
- <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">\r
- <xsl:call-template name="chopPunctuation">\r
- <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>\r
- </xsl:call-template>\r
- </xsl:when>\r
- <xsl:when test="not($chopString)"/>\r
- <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>\r
- </xsl:choose>\r
- </xsl:template>\r
-</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.\r
-<metaInformation>\r
-<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>\r
-</metaInformation>\r
--->
\ No newline at end of file
+<?xml version='1.0'?>
+<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template name="datafield">
+ <xsl:param name="tag"/>
+ <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="subfields"/>
+ <xsl:element name="datafield">
+ <xsl:attribute name="tag">
+ <xsl:value-of select="$tag"/>
+ </xsl:attribute>
+ <xsl:attribute name="ind1">
+ <xsl:value-of select="$ind1"/>
+ </xsl:attribute>
+ <xsl:attribute name="ind2">
+ <xsl:value-of select="$ind2"/>
+ </xsl:attribute>
+ <xsl:copy-of select="$subfields"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="subfieldSelect">
+ <xsl:param name="codes"/>
+ <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="subdivCodes"/>
+ <xsl:param name="subdivDelimiter"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($codes, @code)">
+ <xsl:if test="contains($subdivCodes, @code)">
+ <xsl:value-of select="$subdivDelimiter"/>
+ </xsl:if>
+ <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
+ </xsl:template>
+
+ <xsl:template name="buildSpaces">
+ <xsl:param name="spaces"/>
+ <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
+ <xsl:if test="$spaces>0">
+ <xsl:value-of select="$char"/>
+ <xsl:call-template name="buildSpaces">
+ <xsl:with-param name="spaces" select="$spaces - 1"/>
+ <xsl:with-param name="char" select="$char"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="chopPunctuation">
+ <xsl:param name="chopString"/>
+ <xsl:variable name="length" select="string-length($chopString)"/>
+ <xsl:choose>
+ <xsl:when test="$length=0"/>
+ <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not($chopString)"/>
+ <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
+ </xsl:choose>
+<xsl:text> </xsl:text>
+ </xsl:template>
+
+
+ <!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags
+ - should be called immediately before the corresonding latin tags are processed
+ - tags in right-to-left languages are displayed floating right
+ * Parameter:
+ + basetags: display these tags if found in linkage section ( subfield 6) of tag 880
+ + codes: display these subfields codes
+ * Options:
+ - class: wrap output in <span class="$class">...</span>
+ - label: prefix each(!) tag with label $label
+ - bibno: link to biblionumber $bibno
+ - index: build a search link using index $index with subfield $a as key; if subfield $9 is present use index 'an' with key $9 instead.
+ * Limitations:
+ - displays every field on a separate line (to switch between rtl and ltr)
+ * Pitfalls:
+ (!) output might be empty
+ -->
+ <xsl:template name="m880Select">
+ <xsl:param name="basetags"/> <!-- e.g. 100,700,110,710 -->
+ <xsl:param name="codes"/> <!-- e.g. abc -->
+ <xsl:param name="class"/> <!-- e.g. results_summary -->
+ <xsl:param name="label"/> <!-- e.g. Edition -->
+ <xsl:param name="bibno"/>
+ <xsl:param name="index"/> <!-- e.g. au -->
+
+ <xsl:for-each select="marc:datafield[@tag=880]">
+ <xsl:variable name="code6" select="marc:subfield[@code=6]"/>
+ <xsl:if test="contains(string($basetags), substring($code6,1,3))">
+ <span>
+ <xsl:if test="boolean($class)">
+ <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- display right-to-left tags floating right of their left-to-right counterparts -->
+ <xsl:when test="substring($code6,string-length($code6)-1,2) ='/r'">
+ <xsl:attribute name="style">display:block; text-align:right; float:right; width:50%; padding-left:20px</xsl:attribute>
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style">display:block; </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="boolean($label)">
+ <span class="label">
+ <xsl:value-of select="$label"/>
+ </span>
+ </xsl:if>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($codes, @code)">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="boolean($bibno)">
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
+ <xsl:value-of select="$str"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+ <xsl:value-of select="$str"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="boolean($index)">
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="$index"/>:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+ <xsl:value-of select="$str"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </span>
+ </xsl:if>
+ </xsl:for-each>
+
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
+<metaInformation>
+<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
+</metaInformation>
+-->