[Koha] xslt and how not to show field if there are no data

schnydszch eugenegf at yahoo.com
Sat Feb 22 05:02:58 NZDT 2014


hi all! I'm trying to modify my koha's xslt. I have the following:
<xsl:if test="marc:datafield[@tag=597]">
        Musical director: 
            <xsl:for-each select="marc:datafield[@tag=597]">
                <xsl:call-template name="chopPunctuation">
                  <xsl:with-param name="chopString">
                    <xsl:call-template name="subfieldSelect">
                        <xsl:with-param name="codes">a</xsl:with-param>
                    </xsl:call-template>
                   </xsl:with-param>
               </xsl:call-template>
                    <xsl:choose><xsl:when
test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>;
</xsl:text></xsl:otherwise></xsl:choose>
            </xsl:for-each>
        
        </xsl:if>
		
		<xsl:if test="marc:datafield[@tag=597]">
        Musical director's Write up: 
            <xsl:for-each select="marc:datafield[@tag=597]">
                <xsl:call-template name="chopPunctuation">
                  <xsl:with-param name="chopString">
                    <xsl:call-template name="subfieldSelect">
                        <xsl:with-param name="codes">b</xsl:with-param>
                    </xsl:call-template>
                   </xsl:with-param>
               </xsl:call-template>
                    <xsl:choose><xsl:when
test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>;
</xsl:text></xsl:otherwise></xsl:choose>
            </xsl:for-each>
        
        </xsl:if>
		
		<xsl:if test="marc:datafield[@tag=597]">
        Musical director's Date of birth: 
            <xsl:for-each select="marc:datafield[@tag=597]">
                <xsl:call-template name="chopPunctuation">
                  <xsl:with-param name="chopString">
                    <xsl:call-template name="subfieldSelect">
                        <xsl:with-param name="codes">c</xsl:with-param>
                    </xsl:call-template>
                   </xsl:with-param>
               </xsl:call-template>
                    <xsl:choose><xsl:when
test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>;
</xsl:text></xsl:otherwise></xsl:choose>
            </xsl:for-each>
        
        </xsl:if>

What I actually want my Koha to show is if there are no data in the example
597$b, the string Musical director's write up should not show. but I'm still
seeing the field with no data, especially if one of the subfileds have data
on it. So, how do I make Koha to not show MARC field-subfields with blank
data. Thanks in advance and cheers!



--
View this message in context: http://koha.1045719.n5.nabble.com/xslt-and-how-not-to-show-field-if-there-are-no-data-tp5788311.html
Sent from the Koha-general mailing list archive at Nabble.com.


More information about the Koha mailing list