XSLT 2.0, stylesheet and data at https://xsltfiddle.liberty-development.net/bFDb2D3/4
I am transforming medieval documents encoded in tei-xml into webpages where the user can toggle between two different views of the documents, as well as see the translation and various footnotes (eg). This requires multiple layers of processing to output:
- Two latin versions ('inter' and 'diplo') between which the user can toggle (derived from the same tei markup)
- Translated version with almost no transformations (just paragraph formatting and italics)
- Critical apparatus using footnoting # a, b, c, etc.
- Historical footnotes using footnoting # 1, 2, 3, etc.
I am using modes
in order to handle the levels of processing, and each mode on its own works fine, but together they are missing outputs.
What should output:
<div class="inter"><p>
with all transformations modeinter
+fn-add-marker
[this should contain<a href>
, superscript letters and numbers in text]<div class="diplo"><p>
with all transformations modediplo
+fn-add-marker
[this should contain [text] , line numbers, superscript letters and numbers in text]<div><p>
with translations<div>
with critical apparatus<div>
with footnotes
The XSLTfiddle output is:
- URL and superscript letters ok! missing superscript numbers (mode
fn-add-marker
) - Superscript letters ok! Line # and [text] ok except where inside
<persName>
or<placeName>
(ie.<xsl:template match="tei:lb">
<xsl:template match="tei:supplied">
) and missing superscript numbers (modefn-add-marker
) - ok!
- ok!
- ok!
With respect to #2, the missing line # and [text] appear to be a result of the templates that treat <persName>
and <placeName>
not handing off to other templates? (templates at lines 173-218)
All templates concerning mode fn-add-marker
are at lines 41-77.
Many thanks in advance.
Basically in XSLT 2, once you work with named modes, you need to make sure in a template belonging to a certain mode, having e.g.
mode="foo"
, that you use e.g.mode="foo"
or more generalmode="#current"
on anyxsl:apply-templates
inside to ensure processing continues in that mode. See https://www.w3.org/TR/xslt20/#element-apply-templates for details.At https://xsltfiddle.liberty-development.net/gWmuiK7 I have tried XSLT to fix your stylesheet and then at https://xsltfiddle.liberty-development.net/bFDb2D3/5 you can see the result of applying the fixed stylesheet. Not sure whether that programmatic approach is the right tool but it might help to demonstrate the suggested use mode
mode
onxsl:apply-templates
.Then I think you need to make sure you process the added markers in the two new modes:
https://xsltfiddle.liberty-development.net/bFDb2D3/6 lines 51 to 66.