Trim whitespace and comma for ,-list for field 600
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 12 Sep 2011 09:09:18 +0000 (11:09 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 12 Sep 2011 09:09:18 +0000 (11:09 +0200)
Fixes bug #4594.

etc/tmarc.xsl

index 8380f3d..ff2af3e 100644 (file)
             <xsl:if test="position() > 1">
               <xsl:text>, </xsl:text>
             </xsl:if>
-            <xsl:value-of select="." />
-          </xsl:for-each>
+           <xsl:variable name='value'>
+             <xsl:value-of select='normalize-space(.)'/>
+           </xsl:variable>
+           <xsl:choose>
+             <xsl:when test="substring($value,string-length($value)) = ','">
+               <xsl:value-of select="substring($value,0,string-length($value)-1)"/>
+             </xsl:when>
+             <xsl:otherwise>
+               <xsl:value-of select="$value"/>
+             </xsl:otherwise>
+           </xsl:choose> 
+         </xsl:for-each>
         </pz:metadata>
       </xsl:for-each>