Discussion:
[Koha] XSLT to add ISBD punctuation
Rubén Fernández Asensio
2018-09-06 03:25:40 UTC
Permalink
Hello all,

Do any of you have any expertise on XSLT? I'm trying to have Koha add
ISBD punctuation to my records in Detail view.
I've started with MARC field 245. I've copied and modified my template
to this:

<xsl:if test="marc:datafield[@tag=245]">
<h1 class="title" property="name">
<xsl:for-each select="marc:datafield[@tag=245]">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">a</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<!-- 13381 add additional subfields-->
<!-- Subtítol -->
<xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='b']">
<xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='b']">
<xsl:text>: </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:if>
<!-- Menció de responsabilitat -->
<xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='c']">
<xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
<xsl:text>/ </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">c</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</h1>
</xsl:if>

And I've put its path in preference OPACXSLTDetailsDisplay, so that
Detail View should now show something like this:

Tuj apude : gvidilo tra la kvartalo de la Centra Oficejo de UEA /
Humphrey Tonkin, en kunlaboro kun Peter Bulthuis kaj Francisco Veuthey

But when I deploy it it doesn't work. The view appears blank in the
beginning, and after a few refreshes it shows the record without
punctuation.

Any clues?

Ruben
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://lists.katipo.co.nz/mai
Rubén Fernández Asensio
2018-09-06 13:10:59 UTC
Permalink
Nevermind, this did the trick:

<xsl:if test="marc:datafield[@tag=245]">
<h1 class="title" property="name">
<xsl:for-each select="marc:datafield[@tag=245]">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">a</xsl:with-param>
</xsl:call-template>
<!-- Subtítol -->
<xsl:if test="marc:subfield[@code='b']">
<xsl:text> : </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- Responsabilitat -->
<xsl:if test="marc:subfield[@code='c']">
<xsl:text> / </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">c</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</h1>
</xsl:if>

Sorry to bother.
Rubén
Post by Rubén Fernández Asensio
Hello all,
Do any of you have any expertise on XSLT? I'm trying to have Koha add
ISBD punctuation to my records in Detail view.
I've started with MARC field 245. I've copied and modified my template
 <h1 class="title" property="name">
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">a</xsl:with-param>
 </xsl:call-template>
 <xsl:text> </xsl:text>
 <!-- 13381 add additional subfields-->
 <!-- Subtítol -->
 <xsl:text>: </xsl:text>
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">b</xsl:with-param>
 </xsl:call-template>
 <xsl:text> </xsl:text>
 </xsl:for-each>
 </xsl:if>
 <!-- Menció de responsabilitat -->
  <xsl:for-each
 <xsl:text>/ </xsl:text>
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">c</xsl:with-param>
 </xsl:call-template>
 <xsl:text> </xsl:text>
 </xsl:for-each>
 </xsl:if>
 </xsl:for-each>
 </h1>
 </xsl:if>
And I've put its path in preference OPACXSLTDetailsDisplay, so that
Tuj apude : gvidilo tra la kvartalo de la Centra Oficejo de UEA /
Humphrey Tonkin, en kunlaboro kun Peter Bulthuis kaj Francisco Veuthey
But when I deploy it it doesn't work. The view appears blank in the
beginning, and after a few refreshes it shows the record without
punctuation.
Any clues?
Ruben
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://l

Loading...