fix bibl:printIncollectionCitation()#3` to accept multiple biblScopes#582
Open
SteffenAstheimer wants to merge 2 commits intodevelopfrom
Open
fix bibl:printIncollectionCitation()#3` to accept multiple biblScopes#582SteffenAstheimer wants to merge 2 commits intodevelopfrom
SteffenAstheimer wants to merge 2 commits intodevelopfrom
Conversation
The file A110745 was actually poorly written and changed in the last weeks, so I deleted this test without replacement, as there was no adequate file to add upon the first test.
peterstadler
requested changes
Feb 4, 2026
Member
peterstadler
left a comment
There was a problem hiding this comment.
Do we need to add a test for one of the failing IDs (A031324, A031792, A031596)?
Or are these cases already covered?
| let $articleTitle := bibl:printTitles($biblStruct/tei:analytic/tei:title, ()) | ||
| let $bookTitle := <xhtml:span class="collectionTitle">{bibl:printTitles($biblStruct/tei:monogr/tei:title, $biblStruct/tei:monogr/tei:edition)/node()}</xhtml:span> | ||
| let $biblScope := $biblStruct/tei:monogr/tei:imprint/tei:biblScope[not(@unit = 'pp' or @unit = 'col')] | ||
| let $biblScopes := for $unit in ('vol', 'jg', 'issue', 'nr') return $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = $unit] |
Member
There was a problem hiding this comment.
You don't need a for loop since the = operator works on sequences, see e.g. https://www.data2type.de/xml-xslt-xslfo/xpath/referenz/operatoren/vergleichsausdruecke
Suggested change
| let $biblScopes := for $unit in ('vol', 'jg', 'issue', 'nr') return $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = $unit] | |
| let $biblScopes := $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = ('vol', 'jg', 'issue', 'nr')] |
| ', in: ', | ||
| $bookTitle, | ||
| if ($biblScope) then (<xhtml:span class="{$biblScope/@unit}">{bibl:print-single-biblScope-unit(', ', $biblScope, $lang)}</xhtml:span>) else (), | ||
| if(exists($biblScopes)) then for $biblScope in $biblScopes return (<xhtml:span class="{string($biblScope/@unit)}">{bibl:print-single-biblScope-unit(', ', $biblScope, $lang)}</xhtml:span>) else (), |
Member
There was a problem hiding this comment.
You can skip the test here since the for loop won't do anything for an empty sequence anyway:
Suggested change
| if(exists($biblScopes)) then for $biblScope in $biblScopes return (<xhtml:span class="{string($biblScope/@unit)}">{bibl:print-single-biblScope-unit(', ', $biblScope, $lang)}</xhtml:span>) else (), | |
| for $biblScope in $biblScopes return (<xhtml:span class="{string($biblScope/@unit)}">{bibl:print-single-biblScope-unit(', ', $biblScope, $lang)}</xhtml:span>), |
| @@ -41,7 +41,6 @@ declare | |||
|
|
|||
| declare | |||
| %test:args('A111038') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='collectionTitle'>„Ei, dem alten Herrn zoll’ ich Achtung gern’“. Festschrift für Joachim Veit zum 60. Geburtstag</xhtml:span>") | |||
| %test:args('A110745') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='collectionTitle'>Genie, Irrsinn und Ruhm. Die Komponisten<xhtml:span class='edition'>, 7. völlig neu bearb. Auflage</xhtml:span></xhtml:span>") | |||
Member
There was a problem hiding this comment.
ok, I see that this file has changed from "inbook" to "book" so there's no collectionTitle anymore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the cardinality errors described in issue #581 and improves the rendering of
<biblScope>elements for writings, specifically by accepting multiple of those and sorting them by 'vol', 'jg', 'issue', and 'nr'.I tested by locally HTTP probing all writings and got zero bad requests. I also manually tested all writings, that use the formerly malfunctioning
bibl:printIncollectionCitation()#3function.Also checked and updated the unit tests meanwhile.