diff --git a/modules/intermediate_format/identification.xqm b/modules/intermediate_format/identification.xqm index a2be20b1c14d482633eb393cca85633dd245cd70..2ec5afe6446822b6f0c416503988530b96f66d72 100644 --- a/modules/intermediate_format/identification.xqm +++ b/modules/intermediate_format/identification.xqm @@ -171,6 +171,11 @@ declare function ident:right-branch-axis $target/child::node()[last()]/child::node()[last()] ) + (: If tei:apps last child is a tei:rdg[pp, pt] stop here and return the tei:app :) + else if ( $target/child::node()[last()][ self::rdg[@type eq "pp" or @type eq "pt"] ] ) then ( + $target + ) + (: If tei:app has no last child tei:rdg[ppl, ptl] and its tei:lem is not empty change the axis to tei:lems last child() :) else if ( not(empty($target/child::lem/node())) ) then (