|
2406 | 2406 | <xsl:value-of select="t:idno"/> |
2407 | 2407 | </xsl:otherwise> |
2408 | 2408 | </xsl:choose> |
2409 | | - <!-- only do anything if t:citedRange has non-blank content --> |
2410 | | - <xsl:if |
2411 | | - test="string-length(normalize-space(t:citedRange)) > 0"> |
2412 | | - <xsl:choose> |
2413 | | - <xsl:when |
2414 | | - test="t:citedRange[contains(., '-')] or t:citedRange[contains(., '–')]"> |
2415 | | - <xsl:text>, fols. </xsl:text> |
2416 | | - </xsl:when> |
2417 | | - <xsl:otherwise> |
2418 | | - <xsl:text>, fol. </xsl:text> |
2419 | | - </xsl:otherwise> |
2420 | | - </xsl:choose> |
| 2409 | + <!-- |
| 2410 | + MANUSCRIPT JOIN ONLY: render the citedRange folio reference(s). |
| 2411 | + Reads BOTH the text value AND @from/@to so no data is missed: |
| 2412 | + prefer the citedRange text; if it is empty, build the value |
| 2413 | + from @from/@to. Handles multiple citedRanges (comma-separated) |
| 2414 | + and recognises hyphen / en dash / em dash when deciding |
| 2415 | + fol. vs fols. |
| 2416 | + --> |
| 2417 | + <!-- |
| 2418 | + citedRanges that carry data in either the text or @from |
| 2419 | + --> |
| 2420 | + <xsl:variable name="mjCitedRanges" |
| 2421 | + select="t:citedRange[normalize-space(.) != '' or normalize-space(@from) != '']"/> |
| 2422 | + <xsl:if test="exists($mjCitedRanges)"> |
| 2423 | + <!-- |
| 2424 | + plural 'fols.' if any range spans (a dash in the text, |
| 2425 | + or @to differs from @from), or there is more than one range |
| 2426 | + --> |
| 2427 | + <xsl:variable name="mjAnyRange" select=" |
| 2428 | + some $c in $mjCitedRanges |
| 2429 | + satisfies (contains($c, '-') or contains($c, '–') or contains($c, '—') |
| 2430 | + or (normalize-space($c/@to) != '' and $c/@to != $c/@from))"/> |
| 2431 | + <xsl:value-of |
| 2432 | + select="if ($mjAnyRange or count($mjCitedRanges) gt 1) then ', fols. ' else ', fol. '"/> |
| 2433 | + <xsl:for-each select="$mjCitedRanges"> |
| 2434 | + <xsl:if test="position() gt 1">, </xsl:if> |
| 2435 | + <!-- |
| 2436 | + prefer the text value; fall back to @from/@to so an |
| 2437 | + attribute-only citedRange is not dropped |
| 2438 | + --> |
| 2439 | + <xsl:choose> |
| 2440 | + <xsl:when test="normalize-space(.) != ''"> |
| 2441 | + <xsl:value-of select="normalize-space(.)"/> |
| 2442 | + </xsl:when> |
| 2443 | + <xsl:when test="normalize-space(@to) != '' and @to != @from"> |
| 2444 | + <xsl:value-of select="concat(@from, '–', @to)"/> |
| 2445 | + </xsl:when> |
| 2446 | + <xsl:when test="normalize-space(@from) != ''"> |
| 2447 | + <xsl:value-of select="@from"/> |
| 2448 | + </xsl:when> |
| 2449 | + </xsl:choose> |
| 2450 | + </xsl:for-each> |
2421 | 2451 | </xsl:if> |
2422 | | - <xsl:value-of select="t:citedRange"/> |
2423 | 2452 | </p> |
2424 | 2453 | </xsl:for-each> |
2425 | 2454 | </div> |
|
0 commit comments