Bug 9213 - Implement analytics for NORMARC XSLT
authorMagnus Enger <magnus@enger.priv.no>
Thu, 24 Jan 2013 22:17:45 +0000 (23:17 +0100)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Wed, 20 Mar 2013 18:40:47 +0000 (14:40 -0400)
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>
etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xml
etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xsl
etc/zebradb/marc_defs/normarc/biblios/record.abs
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetResults.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACResults.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl

index fd012c9..c8ac5d0 100644 (file)
     <target_index>Title:w</target_index>
     <target_index>Title-other-variant:w</target_index>
   </index_data_field>
-  <!--record.abs line 247: melm 773$t      Host-item-->
+  <!--record.abs line 247: melm 773$a      Host-item-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="773" subfields="a">
+    <target_index>Host-item:w</target_index>
+  </index_subfields>
+  <!--record.abs line 248: melm 773$9      Host-Item-Number-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="773" subfields="9">
+    <target_index>Host-Item-Number:w</target_index>
+  </index_subfields>
+  <!--record.abs line 249: melm 773$t      Host-item-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="773" subfields="t">
     <target_index>Host-item:w</target_index>
   </index_subfields>
-  <!--record.abs line 248: melm 780$t      Title-->
+  <!--record.abs line 250: melm 773$w      Record-control-number-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="773" subfields="w">
+    <target_index>Record-control-number:w</target_index>
+  </index_subfields>
+  <!--record.abs line 251: melm 780$t      Title-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="780" subfields="t">
     <target_index>Title:w</target_index>
   </index_subfields>
-  <!--record.abs line 249: melm 780        Title,Title-former,Related-periodical-->
+  <!--record.abs line 252: melm 780        Title,Title-former,Related-periodical-->
   <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="780">
     <target_index>Title:w</target_index>
     <target_index>Title-former:w</target_index>
     <target_index>Related-periodical:w</target_index>
   </index_data_field>
-  <!--record.abs line 250: melm 785        Related-periodical-->
+  <!--record.abs line 253: melm 785        Related-periodical-->
   <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="785">
     <target_index>Related-periodical:w</target_index>
   </index_data_field>
-  <!--record.abs line 252: melm 800$a      Name-and-title-->
+  <!--record.abs line 255: melm 800$a      Name-and-title-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="800" subfields="a">
     <target_index>Name-and-title:w</target_index>
   </index_subfields>
-  <!--record.abs line 254: melm 800$t      Author-title,Name-and-title,Title,Title-series-->
+  <!--record.abs line 257: melm 800$t      Author-title,Name-and-title,Title,Title-series-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="800" subfields="t">
     <target_index>Author-title:w</target_index>
     <target_index>Name-and-title:w</target_index>
     <target_index>Title:w</target_index>
     <target_index>Title-series:w</target_index>
   </index_subfields>
-  <!--record.abs line 255: melm 800$9      Koha-Auth-Number-->
+  <!--record.abs line 258: melm 800$9      Koha-Auth-Number-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="800" subfields="9">
     <target_index>Koha-Auth-Number:w</target_index>
   </index_subfields>
-  <!--record.abs line 256: melm 800        Author,Author-name-personal,Name,Personal-name-->
+  <!--record.abs line 259: melm 800        Author,Author-name-personal,Name,Personal-name-->
   <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="800">
     <target_index>Author:w</target_index>
     <target_index>Author-name-personal:w</target_index>
     <target_index>Name:w</target_index>
     <target_index>Personal-name:w</target_index>
   </index_data_field>
-  <!--record.abs line 257: melm 810$a      Name-and-title-->
+  <!--record.abs line 260: melm 810$a      Name-and-title-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="810" subfields="a">
     <target_index>Name-and-title:w</target_index>
   </index_subfields>
-  <!--record.abs line 258: melm 810$t      Author-title,Name-and-title,Title,Title-series-->
+  <!--record.abs line 261: melm 810$t      Author-title,Name-and-title,Title,Title-series-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="810" subfields="t">
     <target_index>Author-title:w</target_index>
     <target_index>Name-and-title:w</target_index>
     <target_index>Title:w</target_index>
     <target_index>Title-series:w</target_index>
   </index_subfields>
-  <!--record.abs line 259: melm 810$9      Koha-Auth-Number-->
+  <!--record.abs line 262: melm 810$9      Koha-Auth-Number-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="810" subfields="9">
     <target_index>Koha-Auth-Number:w</target_index>
   </index_subfields>
-  <!--record.abs line 260: melm 810        Author,Corporate-name,Author-name-corporate,Name-->
+  <!--record.abs line 263: melm 810        Author,Corporate-name,Author-name-corporate,Name-->
   <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="810">
     <target_index>Author:w</target_index>
     <target_index>Corporate-name:w</target_index>
     <target_index>Author-name-corporate:w</target_index>
     <target_index>Name:w</target_index>
   </index_data_field>
-  <!--record.abs line 261: melm 811$a      Name-and-title-->
+  <!--record.abs line 264: melm 811$a      Name-and-title-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="811" subfields="a">
     <target_index>Name-and-title:w</target_index>
   </index_subfields>
-  <!--record.abs line 262: melm 811$9      Koha-Auth-Number-->
+  <!--record.abs line 265: melm 811$9      Koha-Auth-Number-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="811" subfields="9">
     <target_index>Koha-Auth-Number:w</target_index>
   </index_subfields>
-  <!--record.abs line 264: melm 811$t      Author-title,Name-and-title,Title,Title-series-->
+  <!--record.abs line 267: melm 811$t      Author-title,Name-and-title,Title,Title-series-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="811" subfields="t">
     <target_index>Author-title:w</target_index>
     <target_index>Name-and-title:w</target_index>
     <target_index>Title:w</target_index>
     <target_index>Title-series:w</target_index>
   </index_subfields>
-  <!--record.abs line 265: melm 811        Author,Author-name-corporate,Name,Conference-name-->
+  <!--record.abs line 268: melm 811        Author,Author-name-corporate,Name,Conference-name-->
   <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="811">
     <target_index>Author:w</target_index>
     <target_index>Author-name-corporate:w</target_index>
     <target_index>Name:w</target_index>
     <target_index>Conference-name:w</target_index>
   </index_data_field>
-  <!--record.abs line 266: melm 830$9      Koha-Auth-Number-->
+  <!--record.abs line 269: melm 830$9      Koha-Auth-Number-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="830" subfields="9">
     <target_index>Koha-Auth-Number:w</target_index>
   </index_subfields>
-  <!--record.abs line 267: melm 830        Title,Title-series-->
+  <!--record.abs line 270: melm 830        Title,Title-series-->
   <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="830">
     <target_index>Title:w</target_index>
     <target_index>Title-series:w</target_index>
   </index_data_field>
-  <!--record.abs line 272: melm 999$c      Local-Number:n,Local-Number:w,Local-Number:s-->
+  <!--record.abs line 275: melm 999$c      Local-Number:n,Local-Number:w,Local-Number:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="999" subfields="c">
     <target_index>Local-Number:n</target_index>
     <target_index>Local-Number:w</target_index>
     <target_index>Local-Number:s</target_index>
   </index_subfields>
-  <!--record.abs line 273: melm 999$d      biblioitemnumber:n,biblioitemnumber:w,biblioitemnumber:s-->
+  <!--record.abs line 276: melm 999$d      biblioitemnumber:n,biblioitemnumber:w,biblioitemnumber:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="999" subfields="d">
     <target_index>biblioitemnumber:n</target_index>
     <target_index>biblioitemnumber:w</target_index>
     <target_index>biblioitemnumber:s</target_index>
   </index_subfields>
-  <!--record.abs line 274: melm 942$0      totalissues:n,totalissues:s-->
+  <!--record.abs line 277: melm 942$0      totalissues:n,totalissues:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="0">
     <target_index>totalissues:n</target_index>
     <target_index>totalissues:s</target_index>
   </index_subfields>
-  <!--record.abs line 275: melm 942$2      cn-bib-source-->
+  <!--record.abs line 278: melm 942$2      cn-bib-source-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="2">
     <target_index>cn-bib-source:w</target_index>
   </index_subfields>
-  <!--record.abs line 276: melm 942$6      cn-bib-sort:n,cn-bib-sort:s-->
+  <!--record.abs line 279: melm 942$6      cn-bib-sort:n,cn-bib-sort:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="6">
     <target_index>cn-bib-sort:n</target_index>
     <target_index>cn-bib-sort:s</target_index>
   </index_subfields>
-  <!--record.abs line 277: melm 942$c      itemtype:w-->
+  <!--record.abs line 280: melm 942$c      itemtype:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="c">
     <target_index>itemtype:w</target_index>
   </index_subfields>
-  <!--record.abs line 278: melm 942$n      Suppress:w,Suppress:n-->
+  <!--record.abs line 281: melm 942$n      Suppress:w,Suppress:n-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="n">
     <target_index>Suppress:w</target_index>
     <target_index>Suppress:n</target_index>
   </index_subfields>
-  <!--record.abs line 281: melm 942$h      cn-class-->
+  <!--record.abs line 284: melm 942$h      cn-class-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="h">
     <target_index>cn-class:w</target_index>
   </index_subfields>
-  <!--record.abs line 282: melm 942$i      cn-item-->
+  <!--record.abs line 285: melm 942$i      cn-item-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="i">
     <target_index>cn-item:w</target_index>
   </index_subfields>
-  <!--record.abs line 283: melm 942$k      cn-prefix-->
+  <!--record.abs line 286: melm 942$k      cn-prefix-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="k">
     <target_index>cn-prefix:w</target_index>
   </index_subfields>
-  <!--record.abs line 284: melm 942$m      cn-suffix-->
+  <!--record.abs line 287: melm 942$m      cn-suffix-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="m">
     <target_index>cn-suffix:w</target_index>
   </index_subfields>
-  <!--record.abs line 287: melm 952$0      withdrawn:n,withdrawn:w-->
+  <!--record.abs line 290: melm 952$0      withdrawn:n,withdrawn:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="0">
     <target_index>withdrawn:n</target_index>
     <target_index>withdrawn:w</target_index>
   </index_subfields>
-  <!--record.abs line 288: melm 952$1      lost,lost:n-->
+  <!--record.abs line 291: melm 952$1      lost,lost:n-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="1">
     <target_index>lost:w</target_index>
     <target_index>lost:n</target_index>
   </index_subfields>
-  <!--record.abs line 289: melm 952$2      classification-source-->
+  <!--record.abs line 292: melm 952$2      classification-source-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="2">
     <target_index>classification-source:w</target_index>
   </index_subfields>
-  <!--record.abs line 290: melm 952$3      materials-specified-->
+  <!--record.abs line 293: melm 952$3      materials-specified-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="3">
     <target_index>materials-specified:w</target_index>
   </index_subfields>
-  <!--record.abs line 291: melm 952$4      damaged:n,damaged:w-->
+  <!--record.abs line 294: melm 952$4      damaged:n,damaged:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="4">
     <target_index>damaged:n</target_index>
     <target_index>damaged:w</target_index>
   </index_subfields>
-  <!--record.abs line 292: melm 952$5      restricted:n,restricted:w-->
+  <!--record.abs line 295: melm 952$5      restricted:n,restricted:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="5">
     <target_index>restricted:n</target_index>
     <target_index>restricted:w</target_index>
   </index_subfields>
-  <!--record.abs line 293: melm 952$6      cn-sort:n,cn-sort:s-->
+  <!--record.abs line 296: melm 952$6      cn-sort:n,cn-sort:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="6">
     <target_index>cn-sort:n</target_index>
     <target_index>cn-sort:s</target_index>
   </index_subfields>
-  <!--record.abs line 294: melm 952$7      notforloan:n,notforloan:w-->
+  <!--record.abs line 297: melm 952$7      notforloan:n,notforloan:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="7">
     <target_index>notforloan:n</target_index>
     <target_index>notforloan:w</target_index>
   </index_subfields>
-  <!--record.abs line 295: melm 952$8      ccode-->
+  <!--record.abs line 298: melm 952$8      ccode-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="8">
     <target_index>ccode:w</target_index>
   </index_subfields>
-  <!--record.abs line 296: melm 952$9      itemnumber:n,itemnumber:s-->
+  <!--record.abs line 299: melm 952$9      itemnumber:n,itemnumber:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="9">
     <target_index>itemnumber:n</target_index>
     <target_index>itemnumber:s</target_index>
   </index_subfields>
-  <!--record.abs line 297: melm 952$a      homebranch-->
+  <!--record.abs line 300: melm 952$a      homebranch-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="a">
     <target_index>homebranch:w</target_index>
   </index_subfields>
-  <!--record.abs line 298: melm 952$b      holdingbranch-->
+  <!--record.abs line 301: melm 952$b      holdingbranch-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="b">
     <target_index>holdingbranch:w</target_index>
   </index_subfields>
-  <!--record.abs line 299: melm 952$c      location-->
+  <!--record.abs line 302: melm 952$c      location-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="c">
     <target_index>location:w</target_index>
   </index_subfields>
-  <!--record.abs line 302: melm 952$d      Date-of-acquisition,Date-of-acquisition:d,Date-of-acquisition:s-->
+  <!--record.abs line 305: melm 952$d      Date-of-acquisition,Date-of-acquisition:d,Date-of-acquisition:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="d">
     <target_index>Date-of-acquisition:w</target_index>
     <target_index>Date-of-acquisition:d</target_index>
     <target_index>Date-of-acquisition:s</target_index>
   </index_subfields>
-  <!--record.abs line 303: melm 952$e      acqsource-->
+  <!--record.abs line 306: melm 952$e      acqsource-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="e">
     <target_index>acqsource:w</target_index>
   </index_subfields>
-  <!--record.abs line 304: melm 952$f      coded-location-qualifier-->
+  <!--record.abs line 307: melm 952$f      coded-location-qualifier-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="f">
     <target_index>coded-location-qualifier:w</target_index>
   </index_subfields>
-  <!--record.abs line 305: melm 952$g      price-->
+  <!--record.abs line 308: melm 952$g      price-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="g">
     <target_index>price:w</target_index>
   </index_subfields>
-  <!--record.abs line 308: melm 952$j      stack:n,stack:w-->
+  <!--record.abs line 311: melm 952$j      stack:n,stack:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="j">
     <target_index>stack:n</target_index>
     <target_index>stack:w</target_index>
   </index_subfields>
-  <!--record.abs line 310: melm 952$l      issues:n,issues:w,issues:s-->
+  <!--record.abs line 313: melm 952$l      issues:n,issues:w,issues:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="l">
     <target_index>issues:n</target_index>
     <target_index>issues:w</target_index>
     <target_index>issues:s</target_index>
   </index_subfields>
-  <!--record.abs line 311: melm 952$m      renewals:n,renewals:w-->
+  <!--record.abs line 314: melm 952$m      renewals:n,renewals:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="m">
     <target_index>renewals:n</target_index>
     <target_index>renewals:w</target_index>
   </index_subfields>
-  <!--record.abs line 312: melm 952$n      reserves:n,reserves:w-->
+  <!--record.abs line 315: melm 952$n      reserves:n,reserves:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="n">
     <target_index>reserves:n</target_index>
     <target_index>reserves:w</target_index>
   </index_subfields>
-  <!--record.abs line 313: melm 952$o      Local-classification:w,Local-classification:p,Local-classification:s-->
+  <!--record.abs line 316: melm 952$o      Local-classification:w,Local-classification:p,Local-classification:s-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="o">
     <target_index>Local-classification:w</target_index>
     <target_index>Local-classification:p</target_index>
     <target_index>Local-classification:s</target_index>
   </index_subfields>
-  <!--record.abs line 314: melm 952$p      barcode,barcode:n-->
+  <!--record.abs line 317: melm 952$p      barcode,barcode:n-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="p">
     <target_index>barcode:w</target_index>
     <target_index>barcode:n</target_index>
   </index_subfields>
-  <!--record.abs line 315: melm 952$q      onloan:n,onloan:w-->
+  <!--record.abs line 318: melm 952$q      onloan:n,onloan:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="q">
     <target_index>onloan:n</target_index>
     <target_index>onloan:w</target_index>
   </index_subfields>
-  <!--record.abs line 316: melm 952$r      datelastseen-->
+  <!--record.abs line 319: melm 952$r      datelastseen-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="r">
     <target_index>datelastseen:w</target_index>
   </index_subfields>
-  <!--record.abs line 317: melm 952$s      datelastborrowed-->
+  <!--record.abs line 320: melm 952$s      datelastborrowed-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="s">
     <target_index>datelastborrowed:w</target_index>
   </index_subfields>
-  <!--record.abs line 318: melm 952$t      copynumber-->
+  <!--record.abs line 321: melm 952$t      copynumber-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="t">
     <target_index>copynumber:w</target_index>
   </index_subfields>
-  <!--record.abs line 319: melm 952$u      uri:u-->
+  <!--record.abs line 322: melm 952$u      uri:u-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="u">
     <target_index>uri:u</target_index>
   </index_subfields>
-  <!--record.abs line 320: melm 952$v      replacementprice-->
+  <!--record.abs line 323: melm 952$v      replacementprice-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="v">
     <target_index>replacementprice:w</target_index>
   </index_subfields>
-  <!--record.abs line 321: melm 952$w      replacementpricedate-->
+  <!--record.abs line 324: melm 952$w      replacementpricedate-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="w">
     <target_index>replacementpricedate:w</target_index>
   </index_subfields>
-  <!--record.abs line 323: melm 952$y      itype:w-->
+  <!--record.abs line 326: melm 952$y      itype:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="y">
     <target_index>itype:w</target_index>
   </index_subfields>
index 7a8dcea..4408bf6 100644 (file)
@@ -616,12 +616,33 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='773']">
     <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="Host-item:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Host-Item-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('t', @code)">
         <z:index name="Host-item:w">
           <xslo:value-of select="."/>
         </z:index>
       </xslo:if>
     </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('w', @code)">
+        <z:index name="Record-control-number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
   </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='780']">
     <xslo:for-each select="marc:subfield">
index 596ed3f..237f434 100644 (file)
@@ -244,7 +244,10 @@ melm 730$r      Music-key
 melm 730$9      Koha-Auth-Number
 melm 730        Title,Title-uniform
 melm 740        Title,Title-other-variant
+melm 773$a      Host-item
+melm 773$9         Host-Item-Number
 melm 773$t      Host-item
+melm 773$w      Record-control-number
 melm 780$t      Title
 melm 780        Title,Title-former,Related-periodical
 melm 785        Related-periodical
index 9751a58..4c56c4e 100644 (file)
@@ -14,6 +14,7 @@
     <xsl:template match="marc:record">
 
         <!-- Sysprefs -->
+        <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
         <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
                </span>
         </xsl:if>
 
+        <!-- Analytics -->
+        <xsl:if test="$leader7='s' or $leader7='c'">
+        <span class="results_summary analytics"><span class="label">Analytics: </span>
+            <a>
+            <xsl:choose>
+            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
+            </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>Show analytics</xsl:text>
+            </a>
+        </span>
+        </xsl:if>
+
+        <!-- 773 - Links from child to parent -->
+        <xsl:if test="marc:datafield[@tag=773]">
+        <xsl:for-each select="marc:datafield[@tag=773]">
+        <xsl:if test="@ind1=0">
+        <span class="results_summary in"><span class="label">
+        <xsl:choose>
+        <xsl:when test="@ind2=' '">
+            In:
+        </xsl:when>
+        <xsl:when test="@ind2=8">
+            <xsl:if test="marc:subfield[@code='i']">
+                <xsl:value-of select="marc:subfield[@code='i']"/>
+            </xsl:if>
+        </xsl:when>
+        </xsl:choose>
+        </span>
+                <xsl:variable name="f773">
+                    <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">at</xsl:with-param>
+                    </xsl:call-template></xsl:with-param></xsl:call-template>
+                </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
+                        <xsl:value-of select="translate($f773, '()', '')"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:when>
+                <xsl:when test="marc:subfield[@code='0']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+        <xsl:if test="marc:subfield[@code='n']">
+            <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+        </xsl:if>
+        </xsl:if>
+        </xsl:for-each>
+        </xsl:if>
+
         <!-- Publisher Statement -->
         
         <xsl:if test="marc:datafield[@tag=260]">
index e73a583..5708190 100644 (file)
@@ -6,7 +6,7 @@
   xmlns:items="http://www.koha-community.org/items"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   exclude-result-prefixes="marc items">
-    <xsl:import href="MARC21slimUtils.xsl"/>
+    <xsl:import href="NORMARCslimUtils.xsl"/>
     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
     <xsl:key name="item-by-status" match="items:item" use="items:status"/>
     <xsl:key name="item-by-status-and-branch" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
@@ -16,6 +16,7 @@
     </xsl:template>
     <xsl:template match="marc:record">
 
+        <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
         <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
         <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
        </span>
     </xsl:if>
 
+        <!-- Analytics -->
+        <xsl:if test="$leader7='s' or $leader7='c'">
+        <span class="results_summary analytics"><span class="label">Analytics: </span>
+            <a>
+            <xsl:choose>
+            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
+            </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>Show analytics</xsl:text>
+            </a>
+        </span>
+        </xsl:if>
+
+        <!-- 773 - Links from child to parent -->
+        <xsl:if test="marc:datafield[@tag=773]">
+        <xsl:for-each select="marc:datafield[@tag=773]">
+        <xsl:if test="@ind1=0">
+        <span class="results_summary in"><span class="label">
+        <xsl:choose>
+        <xsl:when test="@ind2=' '">
+            In:
+        </xsl:when>
+        <xsl:when test="@ind2=8">
+            <xsl:if test="marc:subfield[@code='i']">
+                <xsl:value-of select="marc:subfield[@code='i']"/>
+            </xsl:if>
+        </xsl:when>
+        </xsl:choose>
+        </span>
+                <xsl:variable name="f773">
+                    <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">at</xsl:with-param>
+                    </xsl:call-template></xsl:with-param></xsl:call-template>
+                </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
+                        <xsl:value-of select="translate($f773, '()', '')"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:when>
+                <xsl:when test="marc:subfield[@code='0']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+        <xsl:if test="marc:subfield[@code='n']">
+            <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+        </xsl:if>
+        </xsl:if>
+        </xsl:for-each>
+        </xsl:if>
+
     <span class="results_summary">
     <xsl:if test="$typeOf008!=''">
         <span class="label">Materialtype: </span>
index 606727e..eb0b2ba 100644 (file)
 <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,']})&gt;','))))')"/>
+           <xsl:choose>
+             <xsl:when test="contains($tranW,')')">
+               <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;',''))"/>
+             </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">
index 00cebb7..a6f1a2f 100644 (file)
@@ -17,6 +17,7 @@
     <xsl:template match="marc:record">
 
         <!-- Sysprefs -->
+        <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
         <xsl:variable name="TracingQuotesLeft">
                </span>
         </xsl:if>
 
+        <!-- Analytics -->
+        <xsl:if test="$leader7='s' or $leader7='c'">
+        <span class="results_summary analytics"><span class="label">Analytics: </span>
+            <a>
+            <xsl:choose>
+            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
+            </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>Show analytics</xsl:text>
+            </a>
+        </span>
+        </xsl:if>
+
+        <!-- 773 - Links from child to parent -->
+        <xsl:if test="marc:datafield[@tag=773]">
+        <xsl:for-each select="marc:datafield[@tag=773]">
+        <xsl:if test="@ind1=0">
+        <span class="results_summary in"><span class="label">
+        <xsl:choose>
+        <xsl:when test="@ind2=' '">
+            In:
+        </xsl:when>
+        <xsl:when test="@ind2=8">
+            <xsl:if test="marc:subfield[@code='i']">
+                <xsl:value-of select="marc:subfield[@code='i']"/>
+            </xsl:if>
+        </xsl:when>
+        </xsl:choose>
+        </span>
+                <xsl:variable name="f773">
+                    <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">at</xsl:with-param>
+                    </xsl:call-template></xsl:with-param></xsl:call-template>
+                </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
+                        <xsl:value-of select="translate($f773, '()', '')"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:when>
+                <xsl:when test="marc:subfield[@code='0']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+        <xsl:if test="marc:subfield[@code='n']">
+            <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+        </xsl:if>
+        </xsl:if>
+        </xsl:for-each>
+        </xsl:if>
+
         <!-- Publisher Statement -->
         
         <xsl:if test="marc:datafield[@tag=260]">
index 2c3597e..7206c7f 100644 (file)
@@ -18,6 +18,8 @@
     </xsl:template>
     <xsl:template match="marc:record">
 
+    <!-- System preferences -->
+    <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
     <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
 
        </span>
     </xsl:if>
 
+        <!-- Analytics -->
+        <xsl:if test="$leader7='s' or $leader7='c'">
+        <span class="results_summary analytics"><span class="label">Analytics: </span>
+            <a>
+            <xsl:choose>
+            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
+            </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>Show analytics</xsl:text>
+            </a>
+        </span>
+        </xsl:if>
+
+        <!-- 773 - Links from child to parent -->
+        <xsl:if test="marc:datafield[@tag=773]">
+        <xsl:for-each select="marc:datafield[@tag=773]">
+        <xsl:if test="@ind1=0">
+        <span class="results_summary in"><span class="label">
+        <xsl:choose>
+        <xsl:when test="@ind2=' '">
+            In:
+        </xsl:when>
+        <xsl:when test="@ind2=8">
+            <xsl:if test="marc:subfield[@code='i']">
+                <xsl:value-of select="marc:subfield[@code='i']"/>
+            </xsl:if>
+        </xsl:when>
+        </xsl:choose>
+        </span>
+                <xsl:variable name="f773">
+                    <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">at</xsl:with-param>
+                    </xsl:call-template></xsl:with-param></xsl:call-template>
+                </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
+                        <xsl:value-of select="translate($f773, '()', '')"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:when>
+                <xsl:when test="marc:subfield[@code='0']">
+                    <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
+                        <xsl:value-of select="$f773"/>
+                    </a>
+                    <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+        <xsl:if test="marc:subfield[@code='n']">
+            <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+        </xsl:if>
+        </xsl:if>
+        </xsl:for-each>
+        </xsl:if>
+
 <xsl:if test="$DisplayOPACiconsXSLT!='0'">
     <span class="results_summary">
     <xsl:if test="$typeOf008!=''">
index 13cff4f..d5b1fc6 100644 (file)
 <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,']})&gt;','))))')"/>
+           <xsl:choose>
+             <xsl:when test="contains($tranW,')')">
+               <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;',''))"/>
+             </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">