|
1100 | 1100 | <xsl:template match="marc:datafield[@tag='362' or @tag='880']" mode="instance362"> |
1101 | 1101 | <xsl:param name="serialization" select="'rdfxml'"/> |
1102 | 1102 | <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable> |
1103 | | - <xsl:variable name="vFirstIssue"><xsl:value-of select="substring-before(marc:subfield[@code='a'],'-')"/></xsl:variable> |
1104 | | - <xsl:variable name="vLastIssue"><xsl:value-of select="substring-after(marc:subfield[@code='a'],'-')"/></xsl:variable> |
1105 | 1103 | <xsl:choose> |
1106 | | - <xsl:when test="$serialization = 'rdfxml'"> |
| 1104 | + <xsl:when test="@ind1='0'"> |
1107 | 1105 | <xsl:choose> |
1108 | | - <xsl:when test="@ind1='0'"> |
1109 | | - <xsl:if test="$vFirstIssue != ''"> |
1110 | | - <bf:firstIssue> |
1111 | | - <xsl:if test="$vXmlLang != ''"> |
1112 | | - <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute> |
1113 | | - </xsl:if> |
1114 | | - <xsl:value-of select="$vFirstIssue"/> |
1115 | | - </bf:firstIssue> |
1116 | | - </xsl:if> |
1117 | | - <xsl:if test="$vLastIssue != ''"> |
1118 | | - <bf:lastIssue> |
1119 | | - <xsl:if test="$vXmlLang != ''"> |
1120 | | - <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute> |
1121 | | - </xsl:if> |
1122 | | - <xsl:value-of select="$vLastIssue"/> |
1123 | | - </bf:lastIssue> |
1124 | | - </xsl:if> |
| 1106 | + <!-- process as a note under some conditions --> |
| 1107 | + <xsl:when test="contains(marc:subfield[@code='a'],';') |
| 1108 | + or not(contains(marc:subfield[@code='a'],'-'))"> |
| 1109 | + <xsl:call-template name="numberingNote"> |
| 1110 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1111 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1112 | + <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/> |
| 1113 | + </xsl:call-template> |
| 1114 | + </xsl:when> |
| 1115 | + <!-- '=' indicates parallel statements --> |
| 1116 | + <xsl:when test="contains(marc:subfield[@code='a'],'=')"> |
| 1117 | + <xsl:choose> |
| 1118 | + <xsl:when test="not(contains(substring-after(marc:subfield[@code='a'],'='),'='))"> |
| 1119 | + <xsl:variable name="vStatement1"> |
| 1120 | + <xsl:value-of select="normalize-space(substring-before(marc:subfield[@code='a'],'='))"/> |
| 1121 | + </xsl:variable> |
| 1122 | + <xsl:variable name="vStatement2"> |
| 1123 | + <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code='a'],'='))"/> |
| 1124 | + </xsl:variable> |
| 1125 | + <!-- first statement --> |
| 1126 | + <xsl:choose> |
| 1127 | + <xsl:when test="contains($vStatement1,')-')"> |
| 1128 | + <xsl:call-template name="firstLastIssue"> |
| 1129 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1130 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1131 | + <xsl:with-param name="pFirstIssue" select="concat(substring-before($vStatement1,')-'),')')"/> |
| 1132 | + <xsl:with-param name="pLastIssue" select="substring-after($vStatement1,')-')"/> |
| 1133 | + </xsl:call-template> |
| 1134 | + </xsl:when> |
| 1135 | + <xsl:when test="contains($vStatement1,'-') |
| 1136 | + and not(contains(substring-after($vStatement1,'-'),'-'))"> |
| 1137 | + <xsl:call-template name="firstLastIssue"> |
| 1138 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1139 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1140 | + <xsl:with-param name="pFirstIssue" select="substring-before($vStatement1,'-')"/> |
| 1141 | + <xsl:with-param name="pLastIssue" select="substring-after($vStatement1,'-')"/> |
| 1142 | + </xsl:call-template> |
| 1143 | + </xsl:when> |
| 1144 | + <xsl:otherwise> |
| 1145 | + <xsl:call-template name="numberingNote"> |
| 1146 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1147 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1148 | + <xsl:with-param name="pNote" select="$vStatement1"/> |
| 1149 | + </xsl:call-template> |
| 1150 | + </xsl:otherwise> |
| 1151 | + </xsl:choose> |
| 1152 | + <!-- second statement --> |
| 1153 | + <xsl:choose> |
| 1154 | + <xsl:when test="contains($vStatement2,')-')"> |
| 1155 | + <xsl:call-template name="firstLastIssue"> |
| 1156 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1157 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1158 | + <xsl:with-param name="pFirstIssue" select="concat(substring-before($vStatement2,')-'),')')"/> |
| 1159 | + <xsl:with-param name="pLastIssue" select="substring-after($vStatement2,')-')"/> |
| 1160 | + </xsl:call-template> |
| 1161 | + </xsl:when> |
| 1162 | + <xsl:when test="contains($vStatement2,'-') |
| 1163 | + and not(contains(substring-after($vStatement2,'-'),'-'))"> |
| 1164 | + <xsl:call-template name="firstLastIssue"> |
| 1165 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1166 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1167 | + <xsl:with-param name="pFirstIssue" select="substring-before($vStatement2,'-')"/> |
| 1168 | + <xsl:with-param name="pLastIssue" select="substring-after($vStatement2,'-')"/> |
| 1169 | + </xsl:call-template> |
| 1170 | + </xsl:when> |
| 1171 | + <xsl:otherwise> |
| 1172 | + <xsl:call-template name="numberingNote"> |
| 1173 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1174 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1175 | + <xsl:with-param name="pNote" select="$vStatement2"/> |
| 1176 | + </xsl:call-template> |
| 1177 | + </xsl:otherwise> |
| 1178 | + </xsl:choose> |
| 1179 | + </xsl:when> |
| 1180 | + <xsl:otherwise> |
| 1181 | + <xsl:call-template name="numberingNote"> |
| 1182 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1183 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1184 | + <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/> |
| 1185 | + </xsl:call-template> |
| 1186 | + </xsl:otherwise> |
| 1187 | + </xsl:choose> |
1125 | 1188 | </xsl:when> |
| 1189 | + <!-- ')-' as split between first/last --> |
| 1190 | + <xsl:when test="contains(marc:subfield[@code='a'],')-')"> |
| 1191 | + <xsl:call-template name="firstLastIssue"> |
| 1192 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1193 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1194 | + <xsl:with-param name="pFirstIssue" select="concat(substring-before(marc:subfield[@code='a'],')-'),')')"/> |
| 1195 | + <xsl:with-param name="pLastIssue" select="substring-after(marc:subfield[@code='a'],')-')"/> |
| 1196 | + </xsl:call-template> |
| 1197 | + </xsl:when> |
| 1198 | + <!-- more than one hyphen, too hard to parse --> |
| 1199 | + <xsl:when test="contains(substring-after(marc:subfield[@code='a'],'-'),'-')"> |
| 1200 | + <xsl:call-template name="numberingNote"> |
| 1201 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1202 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1203 | + <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/> |
| 1204 | + </xsl:call-template> |
| 1205 | + </xsl:when> |
| 1206 | + <!-- the standard case (one hyphen, not parallel) --> |
1126 | 1207 | <xsl:otherwise> |
1127 | | - <bf:note> |
1128 | | - <bf:Note> |
1129 | | - <bf:noteType>Numbering</bf:noteType> |
1130 | | - <rdfs:label> |
1131 | | - <xsl:if test="$vXmlLang != ''"> |
1132 | | - <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute> |
1133 | | - </xsl:if> |
1134 | | - <xsl:value-of select="marc:subfield[@code='a']"/> |
1135 | | - </rdfs:label> |
1136 | | - </bf:Note> |
1137 | | - </bf:note> |
| 1208 | + <xsl:call-template name="firstLastIssue"> |
| 1209 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1210 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1211 | + <xsl:with-param name="pFirstIssue" select="substring-before(marc:subfield[@code='a'],'-')"/> |
| 1212 | + <xsl:with-param name="pLastIssue" select="substring-after(marc:subfield[@code='a'],'-')"/> |
| 1213 | + </xsl:call-template> |
1138 | 1214 | </xsl:otherwise> |
1139 | 1215 | </xsl:choose> |
1140 | 1216 | </xsl:when> |
| 1217 | + <xsl:otherwise> |
| 1218 | + <xsl:call-template name="numberingNote"> |
| 1219 | + <xsl:with-param name="serialization" select="$serialization"/> |
| 1220 | + <xsl:with-param name="pXmlLang" select="$vXmlLang"/> |
| 1221 | + <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/> |
| 1222 | + </xsl:call-template> |
| 1223 | + </xsl:otherwise> |
| 1224 | + </xsl:choose> |
| 1225 | + </xsl:template> |
| 1226 | + |
| 1227 | + <xsl:template name="numberingNote"> |
| 1228 | + <xsl:param name="serialization" select="'rdfxml'"/> |
| 1229 | + <xsl:param name="pXmlLang"/> |
| 1230 | + <xsl:param name="pNote"/> |
| 1231 | + <xsl:choose> |
| 1232 | + <xsl:when test="$serialization='rdfxml'"> |
| 1233 | + <bf:note> |
| 1234 | + <bf:Note> |
| 1235 | + <bf:noteType>Numbering</bf:noteType> |
| 1236 | + <rdfs:label> |
| 1237 | + <xsl:if test="$pXmlLang != ''"> |
| 1238 | + <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute> |
| 1239 | + </xsl:if> |
| 1240 | + <xsl:value-of select="$pNote"/> |
| 1241 | + </rdfs:label> |
| 1242 | + </bf:Note> |
| 1243 | + </bf:note> |
| 1244 | + </xsl:when> |
1141 | 1245 | </xsl:choose> |
1142 | 1246 | </xsl:template> |
1143 | 1247 |
|
| 1248 | + <xsl:template name="firstLastIssue"> |
| 1249 | + <xsl:param name="serialization" select="'rdfxml'"/> |
| 1250 | + <xsl:param name="pXmlLang"/> |
| 1251 | + <xsl:param name="pFirstIssue"/> |
| 1252 | + <xsl:param name="pLastIssue"/> |
| 1253 | + <xsl:message>first issue: <xsl:value-of select="$pFirstIssue"/></xsl:message> |
| 1254 | + <xsl:message>last issue: <xsl:value-of select="$pLastIssue"/></xsl:message> |
| 1255 | + <xsl:if test="$pFirstIssue != ''"> |
| 1256 | + <xsl:choose> |
| 1257 | + <xsl:when test="$serialization='rdfxml'"> |
| 1258 | + <bf:firstIssue> |
| 1259 | + <xsl:if test="$pXmlLang != ''"> |
| 1260 | + <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute> |
| 1261 | + </xsl:if> |
| 1262 | + <xsl:value-of select="$pFirstIssue"/> |
| 1263 | + </bf:firstIssue> |
| 1264 | + </xsl:when> |
| 1265 | + </xsl:choose> |
| 1266 | + </xsl:if> |
| 1267 | + <xsl:if test="$pLastIssue != ''"> |
| 1268 | + <xsl:choose> |
| 1269 | + <xsl:when test="$serialization='rdfxml'"> |
| 1270 | + <bf:lastIssue> |
| 1271 | + <xsl:if test="$pXmlLang != ''"> |
| 1272 | + <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute> |
| 1273 | + </xsl:if> |
| 1274 | + <xsl:value-of select="$pLastIssue"/> |
| 1275 | + </bf:lastIssue> |
| 1276 | + </xsl:when> |
| 1277 | + </xsl:choose> |
| 1278 | + </xsl:if> |
| 1279 | + </xsl:template> |
| 1280 | + |
1144 | 1281 | </xsl:stylesheet> |
0 commit comments