[Koha] Another XSLT question: adding a line break between multiple names

King, Fred Fred.King at Medstar.net
Thu Feb 23 12:05:17 NZDT 2023


Hi everyone,

I have another XLST question that I haven't been able to figure out: I'm using the 700 field for authors, and I want to start additional authors on a new line instead of separating them by |.

This is what I have now:

    <!-- arthurs -->
<xsl:if test="marc:datafield[@tag=700]">
           <span class="results_summary authors">
               <xsl:if test="marc:datafield[@tag=700]/@ind1=' '">
                   <span class="label">MedStar authors: </span>
               </xsl:if>
               <xsl:for-each select="marc:datafield[@tag=700]">
                  <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute><xsl:value-of select="marc:subfield[@code='a']"/></a>
                  <xsl:if test="marc:subfield[@code='b']"><a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='b']"/>"</xsl:attribute><xsl:text>, </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></a></xsl:if>
                  <xsl:if test="marc:subfield[@code='c']"><a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='c']"/>"</xsl:attribute><xsl:text>, </xsl:text><xsl:value-of select="marc:subfield[@code='c']"/></a></xsl:if>
                             <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
               </xsl:for-each>
           </span>
       </xsl:if>

And it shows on the OPAC details page the way it should:
   Arthur, King, field_b, field_c | Doyle, Arthur Conan | Arthur, Chester Alan, field_b | Murray, Arthur, field_c

But what I'd really like is this:
   Arthur, King, field_b, field_c
   Doyle, Arthur Conan
   Arthur, Chester Alan, field_b
  Murray, Arthur, field_c

Nothing I've tried so far has worked. Any suggestions?

Thanks!

--Fred

Fred King, MSLS, AHIP
Medical Librarian, MedStar Washington Hospital Center
fred.king at medstar.net
202-877-6670
ORCID 0000-0001-5266-0279
MedStar Authors Catalog: http://medstarauthors.org

You know it's cold outside when you go outside and it's cold.
--NPS Twitter

----------------------------------------------------------------------
MedStar Health is a not-for-profit, integrated healthcare delivery system, the largest in Maryland and the Washington, D.C., region. Nationally recognized for clinical quality in heart, orthopedics, cancer and GI.

IMPORTANT: This e-mail (including any attachments) may contain information that is private, confidential, or protected by attorney-client or other privilege. If you received this e-mail in error, please delete it from your system without copying it and notify sender by reply e-mail, so that our records can be corrected... Thank you.

Help conserve valuable resources - only print this email if necessary.




More information about the Koha mailing list