Index leading articles with apostrophes correctly
authorDan Scott <dscott@laurentian.ca>
Thu, 10 Nov 2011 06:05:40 +0000 (01:05 -0500)
committerDan Scott <dscott@laurentian.ca>
Mon, 14 Nov 2011 21:45:57 +0000 (16:45 -0500)
Titles with non-filing characters used to get separated by spaces; not a
problem in English with leading articles like "The" and "A" which are
followed by spaces anyway, but a significant problem for French where
"L'année" is not supposed to be turned into "L' année".

To combat this, we define a titleNonfiling variant in the MODS32
stylesheets that ignores the second indicator and does not wrap leading
articles in the nonSort element, avoiding the injection of unwanted
spaces.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/953.data.MODS32-xsl.sql
Open-ILS/xsl/MARC21slim2MODS32.xsl

index 686471e..e032835 100644 (file)
@@ -47,7 +47,7 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath )
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath ) VALUES 
     (5, 'title', 'uniform', oils_i18n_gettext(5, 'Uniform Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform')]$$ );
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath ) VALUES 
-    (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and not (@type)]$$ );
+    (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$ );
 
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field ) VALUES 
     (7, 'author', 'corporate', oils_i18n_gettext(7, 'Corporate Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='corporate' and mods32:role/mods32:roleTerm[text()='creator']]$$, $$//*[local-name()='namePart']$$, TRUE ); -- /* to fool vim */;
index b0f3e4e..e775b66 100644 (file)
@@ -130,6 +130,42 @@ Added Log Comment
                                </xsl:if>
                                <xsl:call-template name="part"></xsl:call-template>
                        </titleInfo>
+                       <!-- A form of title that ignores non-filing characters; useful
+                                for not converting "L'Oreal" into "L' Oreal" at index time -->
+                       <titleNonfiling>
+                               <xsl:variable name="title">
+                                       <xsl:choose>
+                                               <xsl:when test="marc:subfield[@code='b']">
+                                                       <xsl:call-template name="specialSubfieldSelect">
+                                                               <xsl:with-param name="axis">b</xsl:with-param>
+                                                               <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
+                                                       </xsl:call-template>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:call-template name="subfieldSelect">
+                                                               <xsl:with-param name="codes">abfgk</xsl:with-param>
+                                                       </xsl:call-template>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+                               <title>
+                                       <xsl:value-of select="$title"/>
+                               </title>
+                               <xsl:if test="marc:subfield[@code='b']">
+                                       <subTitle>
+                                               <xsl:call-template name="chopPunctuation">
+                                                       <xsl:with-param name="chopString">
+                                                               <xsl:call-template name="specialSubfieldSelect">
+                                                                       <xsl:with-param name="axis">b</xsl:with-param>
+                                                                       <xsl:with-param name="anyCodes">b</xsl:with-param>
+                                                                       <xsl:with-param name="afterCodes">afgk</xsl:with-param>
+                                                               </xsl:call-template>
+                                                       </xsl:with-param>
+                                               </xsl:call-template>
+                                       </subTitle>
+                               </xsl:if>
+                               <xsl:call-template name="part"></xsl:call-template>
+                       </titleNonfiling>
                </xsl:for-each>
                <xsl:for-each select="marc:datafield[@tag='210']">
                        <titleInfo type="abbreviated">
index 98cea97..303c378 100644 (file)
@@ -130,6 +130,42 @@ Added Log Comment
                                </xsl:if>
                                <xsl:call-template name="part"></xsl:call-template>
                        </titleInfo>
+                       <!-- A form of title that ignores non-filing characters; useful
+                                for not converting "L'Oreal" into "L' Oreal" at index time -->
+                       <titleNonfiling>
+                               <xsl:variable name="title">
+                                       <xsl:choose>
+                                               <xsl:when test="marc:subfield[@code='b']">
+                                                       <xsl:call-template name="specialSubfieldSelect">
+                                                               <xsl:with-param name="axis">b</xsl:with-param>
+                                                               <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
+                                                       </xsl:call-template>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:call-template name="subfieldSelect">
+                                                               <xsl:with-param name="codes">abfgk</xsl:with-param>
+                                                       </xsl:call-template>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+                               <title>
+                                       <xsl:value-of select="$title"/>
+                               </title>
+                               <xsl:if test="marc:subfield[@code='b']">
+                                       <subTitle>
+                                               <xsl:call-template name="chopPunctuation">
+                                                       <xsl:with-param name="chopString">
+                                                               <xsl:call-template name="specialSubfieldSelect">
+                                                                       <xsl:with-param name="axis">b</xsl:with-param>
+                                                                       <xsl:with-param name="anyCodes">b</xsl:with-param>
+                                                                       <xsl:with-param name="afterCodes">afgk</xsl:with-param>
+                                                               </xsl:call-template>
+                                                       </xsl:with-param>
+                                               </xsl:call-template>
+                                       </subTitle>
+                               </xsl:if>
+                               <xsl:call-template name="part"></xsl:call-template>
+                       </titleNonfiling>
                </xsl:for-each>
                <xsl:for-each select="marc:datafield[@tag='210']">
                        <titleInfo type="abbreviated">