Bug 13381 - RDA: 245 field changes in XSLT
authorWinona Salesky <wsalesky@gmail.com>
Mon, 9 Mar 2015 15:20:58 +0000 (11:20 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 20 Apr 2015 14:49:20 +0000 (11:49 -0300)
This patch updates the display of the title and statement of responsibility in the
XSLT display in the staff and OPAC.

Display includes subfields a,b,c,h,k,n,p,s
Subfield c is wrapped in a span class=title_resp_stmt for easy suppression via css.
Subfield h is wrapped in a span class=title_medium for easy suppression via css.

To test:

* Search the opac
* Click the title
* Make sure the fields display properly
* Repeat for a few more titles
* Repeat in the Staff Client

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

index 9a9c889..913a285 100644 (file)
             </h1>
         </xsl:if>
 
+        <!--Bug 13381 -->
         <xsl:if test="marc:datafield[@tag=245]">
-        <h1>
-            <xsl:for-each select="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:if test="marc:subfield[@code='h']">
-                        <xsl:text> </xsl:text>
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">h</xsl:with-param>
-                        </xsl:call-template>
-                    </xsl:if>
-                    <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>
                     <xsl:text> </xsl:text>
-                    <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">fgknps</xsl:with-param>
-                    </xsl:call-template>
-            </xsl:for-each>
-        </h1>
+                    <!-- 13381 add additional subfields-->
+                    <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
+                        <xsl:choose>
+                            <xsl:when test="@code='h'">
+                                <!--  13381 Span class around subfield h so it can be suppressed via css -->
+                                <span class="title_medium"><xsl:apply-templates/> </span>
+                            </xsl:when>
+                            <xsl:when test="@code='c'">
+                                <!--  13381 Span class around subfield c so it can be suppressed via css -->
+                                <span class="title_resp_stmt"><xsl:apply-templates/> </span>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:apply-templates/>
+                                <xsl:text> </xsl:text>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </xsl:for-each>
+            </h1>
         </xsl:if>
 
         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
index 235b326..1f82eff 100644 (file)
         <xsl:attribute name="class">title</xsl:attribute>
 
         <xsl:if test="marc:datafield[@tag=245]">
-        <xsl:for-each select="marc:datafield[@tag=245]">
-            <xsl:variable name="title">
-                     <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">a</xsl:with-param>
-                    </xsl:call-template>
-                    <xsl:if test="marc:subfield[@code='h']">
-                        <xsl:text> </xsl:text>
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">h</xsl:with-param>
-                        </xsl:call-template>
-                    </xsl:if>
-                    <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>
-                <xsl:text> </xsl:text>
-                    <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">fgknps</xsl:with-param>
-                     </xsl:call-template>
-            </xsl:variable>
-            <xsl:variable name="titleChop">
-                <xsl:call-template name="chopPunctuation">
-                    <xsl:with-param name="chopString">
-                        <xsl:value-of select="$title"/>
-                    </xsl:with-param>
+            <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:variable>
-            <xsl:value-of select="$titleChop"/>
-        </xsl:for-each>
+                <xsl:text> </xsl:text>
+                <!-- 13381 add additional subfields-->
+                <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
+                    <xsl:choose>
+                        <xsl:when test="@code='h'">
+                            <!--  13381 Span class around subfield h so it can be suppressed via css -->
+                            <span class="title_medium"><xsl:apply-templates/> </span>
+                        </xsl:when>
+                        <xsl:when test="@code='c'">
+                            <!--  13381 Span class around subfield c so it can be suppressed via css -->
+                            <span class="title_resp_stmt"><xsl:apply-templates/> </span>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:apply-templates/>
+                            <xsl:text> </xsl:text>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </xsl:for-each>
         </xsl:if>
     </a>
 
index ce65648..1c0e766 100644 (file)
             </h1>
         </xsl:if>
 
-        <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:if test="marc:subfield[@code='h']">
-                        <xsl:text> </xsl:text>
+            <!--Bug 13381 -->
+            <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">h</xsl:with-param>
+                            <xsl:with-param name="codes">a</xsl:with-param>
                         </xsl:call-template>
-                    </xsl:if>
-                    <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>
-                <xsl:text> </xsl:text>
-                    <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">fgknps</xsl:with-param>
-                    </xsl:call-template>
-            </xsl:for-each>
-        </h1>
-        </xsl:if>
+                        <!-- 13381 add additional subfields-->
+                        <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
+                            <xsl:choose>
+                                <xsl:when test="@code='h'">
+                                    <!--  13381 Span class around subfield h so it can be suppressed via css -->
+                                    <span class="title_medium"><xsl:apply-templates/> </span>
+                                </xsl:when>
+                                <xsl:when test="@code='c'">
+                                    <!--  13381 Span class around subfield c so it can be suppressed via css -->
+                                    <span class="title_resp_stmt"><xsl:apply-templates/> </span>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:apply-templates/>
+                                    <xsl:text> </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </xsl:for-each>
+                </h1>
+            </xsl:if>
+
 
         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
         <xsl:if test="$display880">
index ab43082..24f15ca 100644 (file)
         <xsl:attribute name="class">title</xsl:attribute>
 
         <xsl:if test="marc:datafield[@tag=245]">
-        <xsl:for-each select="marc:datafield[@tag=245]">
-            <xsl:variable name="title">
-                     <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">a</xsl:with-param>
-                    </xsl:call-template>
-                    <xsl:if test="marc:subfield[@code='h']">
-                        <xsl:text> </xsl:text>
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">h</xsl:with-param>
-                        </xsl:call-template>
-                    </xsl:if>
-                    <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>
-                <xsl:text> </xsl:text>
-                    <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">fgknps</xsl:with-param>
-                     </xsl:call-template>
-            </xsl:variable>
-            <xsl:variable name="titleChop">
-                <xsl:call-template name="chopPunctuation">
-                    <xsl:with-param name="chopString">
-                        <xsl:value-of select="$title"/>
-                    </xsl:with-param>
+            <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:variable>
-            <xsl:value-of select="$titleChop"/>
-        </xsl:for-each>
+                <xsl:text> </xsl:text>
+                <!-- 13381 add additional subfields-->
+                <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
+                    <xsl:choose>
+                        <xsl:when test="@code='h'">
+                            <!--  13381 Span class around subfield h so it can be suppressed via css -->
+                            <span class="title_medium"><xsl:apply-templates/> </span>
+                        </xsl:when>
+                        <xsl:when test="@code='c'">
+                            <!--  13381 Span class around subfield c so it can be suppressed via css -->
+                            <span class="title_resp_stmt"><xsl:apply-templates/> </span>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:apply-templates/>
+                            <xsl:text> </xsl:text>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </xsl:for-each>
         </xsl:if>
     </a>
     <p>