Hi Magnus,
a slightly different approach I use when I need to filter on $2, below an example for 084. It has an advantage if you need to add separators between the fields as the for-each only has the nodes matching your criteria:
<xsl:if test="marc:datafield[@tag=084]/marc:subfield[@code='2'][.='msc']"> <span class="results_summary msc_classification"> <span>MSC: </span> <xsl:for-each select="marc:datafield[@tag=084]/marc:subfield[@code='2'][.='msc']"> <a> <xsl:attribute name="href"><xsl:value-of select="$SearchUrl"/>q=nlc,phr:<xsl:value-of select="str:encode-uri(../marc:subfield[@code='a'], true())"/><xsl:text> msc</xsl:text></xsl:attribute> <xsl:value-of select="../marc:subfield[@code='a']" /> </a> <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"> | </span></xsl:otherwise></xsl:choose> </xsl:for-each> </span> </xsl:if>
Hope that makes sense,
Katrin
try this :
<xsl:for-each select="marc:datafield[@tag='650']">
<xsl:if test="marc:subfield[@code='x'] = 'x' or marc:subfield[@code='x'] = 'y'">
<xsl:value-of test="marc:subfield[@code='a']">
</xsl:if>
</xsl:for-each>
Le 02/03/2021 à 13:22, Magnus Enger a écrit :
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
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/