3f7dd2730a
Problem: Links between anaytics records were not being displayed for NORMARC setups. What this patch does: 1. Add indexing for 773 subfield a, w and 9; both for GRS-1 and DOM indexing (The DOM indexing config was generated from the GRS-1 record.abs) 2. Add "analytics links" to NORMARC XSLT files, both for OPAC and intranet To test: - Make sure you have a NORMARC installation - Set UseControlNumber = Use - Create a parent record with LDR/07=c. Leave 001 empty. - In the "Normal" view, do New > New child record and create another record. Do this twice (so you get a list of hits when you click on the "Show anaytics" links later on). - Do the following steps both in the OPAC and the Intranet: - Search for the parent record in such a way that you can see the record in a *result list* - Check that the "Show analytics" link is displayed, and uses the title of the parent record for linking: ?q=Host-item:<Title of parent record> - Clik on the "Show analytics" link and check that you get a result list with the two child records you created earlier - Go back to the result list and click on the parent record, so you get the *detail view* - Check that the "Show analytics" link is displayed, and uses the title of the parent record for linking: ?q=Host-item:<Title of parent record> - Clik on the "Show analytics" link and check that you get a result list with the two child records you created earlier - Search for one or both of the child records in such a way that you can see the record(s) in a *result list* - Check that the "In: <Title of parent record>" link is displayed, and that it uses the biblionumber of the parent record for linking: ?q=Control-number:<biblionumber of parent record> - Click on the "In: <Title of parent record>" link, and check that the parent record is displayed - Go back to the result list and click on the child record, so you get the *detail view* - Check that the "In: <Title of parent record>" link is displayed, and that it uses the biblionumber of the parent record for linking: ?q=Control-number:<biblionumber of parent record> - Click on the "In: <Title of parent record>" link, and check that the parent record is displayed - Now edit the parent record and put it's biblionumber in 001. Repeat the steps above, and check that everything still works, but that the links are different: - The "Show analytics" link on the parent record should look like this: ?q=rcn:<biblionumber of parent record>+and+(bib-level:a+or+bib-level:b) - The "In: <Title of parent record>" link on the child records should be the same as it was earlier - Now set UseControlNumber = "Don't use" and repeat all of the steps above - All of the links should still be displayed and work, of course - The "In: <Title of parent record>" link on the child records should look like this: ?q=ti,phr:<Title of parent record> - The "Show analytics" link on the parent record should look like this: ?q=Host-item:<Title of parent record> - Change LDR/07 to "s" and repeat all of the steps above - Do all of this both for GRS-1 indexing and for DOM indexing... Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
226 lines
9.5 KiB
XML
226 lines
9.5 KiB
XML
<?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:param name="prefix"/>
|
|
<xsl:param name="suffix"/>
|
|
<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="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><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 extractControlNumber is used to extract the control number (record number) from MARC tags 773/80/85 [etc.] subfield $w.
|
|
Parameter: control number string.
|
|
Assumes LOC convention: (OrgCode)recordNumber.
|
|
If OrgCode is not present, return full string.
|
|
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
|
|
-->
|
|
<xsl:template name="extractControlNumber">
|
|
<xsl:param name="subfieldW"/>
|
|
<xsl:variable name="tranW" select="translate($subfieldW,']})>','))))')"/>
|
|
<xsl:choose>
|
|
<xsl:when test="contains($tranW,')')">
|
|
<xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()<>',''))"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="normalize-space($subfieldW)"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="nameABCDQ">
|
|
<xsl:call-template name="chopPunctuation">
|
|
<xsl:with-param name="chopString">
|
|
<xsl:call-template name="subfieldSelect">
|
|
<xsl:with-param name="codes">aq</xsl:with-param>
|
|
</xsl:call-template>
|
|
</xsl:with-param>
|
|
<xsl:with-param name="punctuation">
|
|
<xsl:text>:,;/ </xsl:text>
|
|
</xsl:with-param>
|
|
</xsl:call-template>
|
|
<xsl:call-template name="termsOfAddress"/>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="nameABCDN">
|
|
<xsl:for-each select="marc:subfield[@code='a']">
|
|
<xsl:call-template name="chopPunctuation">
|
|
<xsl:with-param name="chopString" select="."/>
|
|
</xsl:call-template>
|
|
</xsl:for-each>
|
|
<xsl:for-each select="marc:subfield[@code='b']">
|
|
<xsl:value-of select="."/>
|
|
</xsl:for-each>
|
|
<xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
|
|
<xsl:call-template name="subfieldSelect">
|
|
<xsl:with-param name="codes">cdn</xsl:with-param>
|
|
</xsl:call-template>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="nameACDEQ">
|
|
<xsl:call-template name="subfieldSelect">
|
|
<xsl:with-param name="codes">acdeq</xsl:with-param>
|
|
</xsl:call-template>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="termsOfAddress">
|
|
<xsl:if test="marc:subfield[@code='b' or @code='c']">
|
|
<xsl:call-template name="chopPunctuation">
|
|
<xsl:with-param name="chopString">
|
|
<xsl:call-template name="subfieldSelect">
|
|
<xsl:with-param name="codes">bc</xsl:with-param>
|
|
</xsl:call-template>
|
|
</xsl:with-param>
|
|
</xsl:call-template>
|
|
</xsl:if>
|
|
</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,10,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>
|
|
-->
|