0

XSLT 2.0

The ultimate goal for my project is to output a webpage which provides two views of the same medieval document to the user according to two academic standards, between which the user can toggle with a button (see a proof of concept from 18 months and many iterations ago here ).

This requires me to frequently output two HTML segments from a single XSLT template call, differentiated by their @class with value 'inter' or 'diplo'. This is beginning to negatively affect the 'named entities' (people and places) which are subject to multiple templates.

For example, at https://xsltfiddle.liberty-development.net/3NzcBtW one finds that I treat the very first instance of <persName>:

 <persName nymRef="#Bernard_Cogota_MSP-AU" role="dep">B<supplied reason="expname">ernardus</supplied> Cogata</persName>

So that it outputs:

 <a href="http://foo.com/person/Bernard_Cogota_MSP-AU" class="inter">Bernardus Cogata</a>
 <span class="diplo">Bernardus Cogata</span>

But, if I add this template (seen at https://xsltfiddle.liberty-development.net/3NzcBtW/1):

<xsl:template match="tei:supplied">
    <span class="supplied inter"><xsl:apply-templates/></span>
    <span class="supplied diplo">[<xsl:apply-templates/>]</span>
</xsl:template>

It outputs the two spans to both the <persName> outputs, which will produce incorrect display results from javascript and css:

<a href="http://foo.com/person/Bernard_Cogota_MSP-AU" class="inter">B<span class="supplied inter">ernardus</span><span class="supplied diplo">[ernardus]</span> Cogata</a>
<span class="diplo">B<span class="supplied inter">ernardus</span><span class="supplied diplo">[ernardus]</span> Cogata</span>

I'm wondering if there is a way within XSLT to output rather:

<a href="http://foo.com/person/Bernard_Cogota_MSP-AU" class="inter">B<span class="supplied inter">ernardus</span> Cogata</a>
<span class="diplo">B<span class="supplied diplo">[ernardus]</span> Cogata</span>

Should I instead be considering dumping out the document body (currently ) into two separate <div class="inter"> and <div class="diplo">? Possibly using modes to then build the separate <div>?

The alternate is to set a unique class for each discrete template output and then manage the toggle effect with a large list of classes instead of a whole group. But it strikes me that would be an inelegant solution that outputs more than necessary to the browser.

Many thanks in advance.

jbrehr
  • 775
  • 6
  • 19
  • 1
    I have not managed to understand the details of your current XSLT approach but looking the example http://admin.exist-db.org:44455/exist/apps/inquipedia/depositions.html?depofile=ms609_0452_esteve_fabri.xml you linked to and your own suggestion to use 'two separate `
    ` and `
    `' and then to use separate modes to push the right content to those two `div`s I would say, yes, that seems like the cleaner approach and the cleaner Javascript/CSS `display` toggling than having hundreds of spans that need to be toggled (even if JQuery or modern DOM make that easy).
    – Martin Honnen Oct 21 '18 at 18:10
  • @MartinHonnen indeed, it's a deep encoding of textual documents which I only post fragments of here. It's broken into three parts: the Latin, the translation(s), and the footnotes. As you know now (and constructed for me), the footnotes run under one `mode`. If I use two different `modes` to construct two different `divs`, (ie. `mode="inter"` and `mode ="diplo"`)both of which use the same footnotes, will I run into 'conflicting' of modes? That is to say, will the footnote mode be integrated into both of the `div`s? – jbrehr Oct 21 '18 at 19:59
  • 1
    I don't see the footnotes in the current example https://xsltfiddle.liberty-development.net/3NzcBtW, I am not sure where you had them and whether they will be different for the two different divs, if not, depending on the layout and document structure, I would expect them to be put in a section or div outside of those two divs and that way I would not expect any conflict. – Martin Honnen Oct 21 '18 at 20:22
  • This is the version with footnotes (in fact, two sets of footnotes: app-sources and footnotes-sources) https://xsltfiddle.liberty-development.net/6qVRKwY/1. They should appear equally in each potential
    .
    – jbrehr Oct 21 '18 at 20:56
  • After rearranging per
    , some minor problems coordinating modes: https://stackoverflow.com/questions/52924340/xslt-2-0-co-ordinating-multiple-modes
    – jbrehr Oct 22 '18 at 07:45

0 Answers0