@@ -138,11 +138,12 @@ declare function local:get-data() {
138138 concat ($local:base-uri, $local:idno)
139139 else
140140 concat ("/" , $local:idno)
141+ let $idnos := ($idno, concat ($idno, "/tei" ))
141142 return
142143 <data idno = "{$idno} " >
143144 {
144- for $idno in collection ($local:exist-collection-path)//tei:idno[. = ($idno, concat ($idno, "/tei" )) or ends-with (., $idno)]
145- let $title := string ( $idno/ancestor::tei:TEI/descendant::tei:title[1 ])
145+ for $idno in collection ($local:exist-collection-path)//tei:idno[. = $idnos or ends-with (., $idno)]
146+ let $title := $idno/ancestor::tei:TEI/descendant::tei:title[1 ]/ string (. )
146147 order by $title
147148 return
148149 <record src = "{document-uri (root ($idno))} " name = "{$title} " idno = "{concat ("[" , $idno, "]" )} " />
@@ -162,12 +163,17 @@ if ($local:github = "browse") then
162163 response:stream ($json, "method=TEXT media-type=application/json" )
163164else
164165 let $data := local:get-data ()
165- let $labels := local:get-labels ($data)
166166 return
167- fn:transform (map {
168- "stylesheet-node" : doc ("/db/apps/manuForma/services/tei-to-manuforma-form.xslt" ),
169- "source-node" : $data,
170- "stylesheet-params" : map {
171- xs:QName ('labels' ): $labels
172- }
173- })?output
167+ if (exists ($data//tei:TEI))
168+ then
169+ let $labels := local:get-labels ($data)
170+ return
171+ fn:transform (map {
172+ "stylesheet-node" : doc ("/db/apps/manuForma/services/tei-to-manuforma-form.xslt" ),
173+ "source-node" : $data,
174+ "stylesheet-params" : map {
175+ xs:QName ('labels' ): $labels
176+ }
177+ })?output
178+ else
179+ $data
0 commit comments