You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[refactor] Get the labels before transforming to Markdown. This enables us to in-future replace the transformation to Markdown (that is currently written as an XQuery typeswitch transformation) with an XSLT transformation
declarefunctionlocal:get-label($ref as xs:string) as xs:string {
124
-
let $collection := "/db/apps/majlis-data/data"
125
-
let $expanded-refs := ($ref, concat($ref, "/"), concat($ref, "/tei"))
126
-
let $doc := head(collection($collection)//tei:idno[@typeeq"URI"][. = $expanded-refs]/ancestor::tei:TEI)
127
-
let $label := $doc/descendant::tei:title[1]/descendant-or-self::text()
123
+
(:~
124
+
: Given the a node from a TEI document, we first extract the refs from all descendant tei:relation active, mutual, or passive attributes.
125
+
: Secondly, for each ref we try and find a TEI document in the database whose tei:idno matches the ref,
126
+
: if we find a document, we use it to generate a label for the ref.
127
+
:
128
+
: @param $node the TEI node to start resolving tei:relation from
129
+
:
130
+
: @return A labels element containing refs and their labels, e.g. <labels><label ref="https://jalit.org/person/34">Bahīya</label></labels>, or if there are no labels, then an empty sequence.
() (: NOTE(AR) there is no label for this ref... that is okay as an @active, @mutual, or @passive attribute may contain multiple refs and some of those refs may be external to the database, and therefore we can't resolve them :)
177
+
return
178
+
if (exists($labels))
179
+
then
180
+
<labels>{$labels}</labels>
181
+
else
182
+
()
130
183
};
131
184
132
185
declarefunctionlocal:get-data() {
@@ -195,5 +248,6 @@ if ($local:github = "browse") then
0 commit comments