As the title says, this patch implements TraceCompleteSubfields and TraceSubjectSubdivisions for NORMARC XSLT, both for the OPAC and the Intranet. This affects how clickable subject-links are constructed.
To test: Find a record with a complex subject, like "Art -- United States". MARC21 and NORMARC are very similar in how they handle subjects, so testing on a MARC21 database should be OK. Make sure you have these syspref settings: - marcflavour = NORMARC - XSLTDetailsDisplay = using XSLT stylesheets - OPACXSLTDetailsDisplay = using XSLT stylesheets Now try the different combinations of TraceCompleteSubfields and TraceSubjectSubdivisions and check the format of the clickable links, both in the OPAC and staff client. Here's what you should be seeing: 1. TraceCompleteSubfields = Don't force TraceSubjectSubdivisions = Don't include -> q=su:{Art} 2. TraceCompleteSubfields = Force TraceSubjectSubdivisions = Don't include -> q=su,complete-subfield:{Art} 3. TraceCompleteSubfields = Don't force TraceSubjectSubdivisions = Include -> q=(su:{Art}) and (su:{United%20States.}) 4. TraceCompleteSubfields = Force TraceSubjectSubdivisions = Include -> q=(su,complete-subfield:{Art}) and (su,complete-subfield:{United States.}) --- .../prog/en/xslt/NORMARCslim2intranetDetail.xsl | 22 +++++++++++++++--- .../prog/en/xslt/NORMARCslimUtils.xsl | 4 ++- .../prog/en/xslt/NORMARCslim2OPACDetail.xsl | 24 ++++++++++++++++--- .../opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl | 4 ++- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl index 163ed29..b9f6da6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl @@ -15,6 +15,8 @@ <!-- Sysprefs --> <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']"/> <xsl:variable name="leader" select="marc:leader"/> <xsl:variable name="leader6" select="substring($leader,7,1)"/> @@ -293,16 +295,27 @@ </span> </xsl:if> + <!-- Subjects --> + <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']"> - <span class="results_summary"><span class="label">Emner: </span> + <span class="results_summary subjects"><span class="label">Emne(r): </span> <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']"> <a> <xsl:choose> - <xsl:when test="marc:subfield[@code=9]"> + <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'"> <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> </xsl:when> + <xsl:when test="$TraceSubjectSubdivisions='1'"> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdvxyz</xsl:with-param> + <xsl:with-param name="delimeter"> and </xsl:with-param> + <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:{</xsl:with-param> + <xsl:with-param name="suffix">})</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:when> <xsl:otherwise> - <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:{<xsl:value-of select="marc:subfield[@code='a']"/>}</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:call-template name="chopPunctuation"> @@ -313,7 +326,8 @@ <xsl:with-param name="subdivDelimiter">-- </xsl:with-param> </xsl:call-template> </xsl:with-param> - </xsl:call-template></a> + </xsl:call-template> + </a> <xsl:choose> <xsl:when test="position()=last()"></xsl:when> <xsl:otherwise> | </xsl:otherwise> diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl index 7c2bf21..606727e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl @@ -24,13 +24,15 @@ <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="text()"/><xsl:value-of select="$delimeter"/> + <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> diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl index 1a4e042..eefaddd 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl @@ -15,6 +15,10 @@ </xsl:template> <xsl:template match="marc:record"> + + <!-- Sysprefs --> + <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="leader" select="marc:leader"/> <xsl:variable name="leader6" select="substring($leader,7,1)"/> @@ -298,16 +302,27 @@ </span> </xsl:if> + <!-- Subjects --> + <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']"> - <span class="results_summary"><span class="label">Emner: </span> + <span class="results_summary subjects"><span class="label">Emne(r): </span> <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']"> <a> <xsl:choose> - <xsl:when test="marc:subfield[@code=9]"> + <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'"> <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> </xsl:when> + <xsl:when test="$TraceSubjectSubdivisions='1'"> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdvxyz</xsl:with-param> + <xsl:with-param name="delimeter"> and </xsl:with-param> + <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:{</xsl:with-param> + <xsl:with-param name="suffix">})</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:when> <xsl:otherwise> - <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:{<xsl:value-of select="marc:subfield[@code='a']"/>}</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:call-template name="chopPunctuation"> @@ -318,7 +333,8 @@ <xsl:with-param name="subdivDelimiter">-- </xsl:with-param> </xsl:call-template> </xsl:with-param> - </xsl:call-template></a> + </xsl:call-template> + </a> <xsl:choose> <xsl:when test="position()=last()"></xsl:when> <xsl:otherwise> | </xsl:otherwise> diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl index 31317b1..91a0437 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl @@ -25,13 +25,15 @@ <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="text()"/><xsl:value-of select="$delimeter"/> + <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> -- 1.7.2.5 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/