[Koha-devel] XSLT to display keywords with 650$2 = x

Magnus Enger magnus at libriotech.no
Tue Mar 2 13:22:21 CET 2021


Kia ora!

I want to display most keywords as usual, but with an exception for 
those from the 650 field. Specifically, I want to display only those 
keywords that has the value "x" or "y" in subfield $2, and hide the 
other 650-keywords. Any hints on how to this in XSLT would be infinitely 
appreciated, and added to the wiki, so others can benefit from the 
solution.

Here is an example:

   <datafield tag="650" ind1=" " ind2="0">
     <subfield code="a">A</subfield>
     <subfield code="2">x</subfield>
   </datafield>
   <datafield tag="650" ind1=" " ind2="0">
     <subfield code="a">B</subfield>
     <subfield code="2">y</subfield>
   </datafield>
   <datafield tag="650" ind1=" " ind2="0">
     <subfield code="a">C</subfield>
     <subfield code="2">z</subfield>
   </datafield>
   <datafield tag="653" ind1=" " ind2="0">
     <subfield code="a">D</subfield>
   </datafield>

I want to display A and B (because they have $2 = x or y), and D 
(because it is not 650), but not C (because it is 650 and $2 is neither 
x nor y).

Best regards,
Magnus
Libriotech


More information about the Koha-devel mailing list