In my site I use XQuery 3.1 (under eXist-db 4.4) to output XSLT 2.0 transformations of TEI-XML
documents.
Take for example this document http://medieval-inquisition.huma-num.fr/doc/MS609-0176
In my function I get the tei-xml document MS609-0176.xml
as $doc
and the dynamically prepared XSLT as $stylesheet
and then execute the transform:transform
The serialized $stylesheet
(with all nodes included for the parameters) and the tei-xml
document are pasted here:
https://xsltfiddle.liberty-development.net/bdxtrg/6
One of the principle jobs of this transformation is to output footnotes.
The transformation in XSLT fiddle outputs correctly: there are 3 footnotes.
But on the website, the identical transformation and Saxon processor using the identical documents outputs 5 footnotes.
In fact, the problem (across all transformations) is only with processing tei:date[@type='deposition_date']
. The transformation is 'triple-processing' all references to tei:date[@type='deposition_date']
where it only ever exists once in the file. This is happening to this one element in every document (as can be seen by looking at any on the site).
In terms of process steps: footnote numbers are added to the body, then in a separate mode, the XSLT file then uses those numbers to build the footnotes at the bottom. Therefore the problem is in the first step.
The footnote numbers are assigned to tei:date[@type='deposition_date']
at line 80-84 in the XSLT fiddle. They are processed in a unique template from the other elements.
For reference, the Xquery function is:
declare function document:doc-docview($node as node(), $model as map(*), $docset as xs:string)
{
let $stylesheet := document-view:doc-view-xslt($docset)
let $doc := doc(concat($globalvar:URIdata,$docset))
return transform:transform($doc,$stylesheet,())
}
I am completely mystified about how to handle this problem. It's the same processor (Saxon) but different result? Is there some adjustment I can make to the the XSLT file to mitigate this problem?
(I have run the exact same transformation in Oxygen (using Saxon as well), and it produces the correct results as well.)
The eXist-db environment can be accessed and tested here http://ciham-digital.huma-num.fr/exist/apps/eXide/index.html under /db/apps/deheresi/data/MS609-0176.xml and /db/apps/deheresi/modules/document-view (function) document-view:doc-view-xslt