From fb0aa61a7ef03120d362887aadf17b7c5119368a Mon Sep 17 00:00:00 2001
From: Uwe Sikora <sikora@sub.uni-goettingen.de>
Date: Wed, 7 Feb 2018 16:53:09 +0100
Subject: [PATCH] right-branch-axis now handles last tei:rdg[@type = pp|pt]

---
 modules/intermediate_format/identification.xqm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/intermediate_format/identification.xqm b/modules/intermediate_format/identification.xqm
index a2be20b..2ec5afe 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 (
-- 
GitLab