xquery-3.0

Combine two for loops and union results in XQuery

谁说我不能喝 提交于 2021-02-08 10:01:51
问题 Let's say we have this folders not_my_files collections collection1.xml collection2.xml collection3.xml etc... my_files my_documents mydoc1.xml mydoc2.xml mydoc3.xml etc... There are the structure of xml files collection1.xml (same structure for collection2.xml, collection3.xml, etc...) <collection xml:id="name_of_collection_1"> <ref id="id_of_ref_1"> <title>This is title 1 of first document in this collection</title> </ref> <ref id="id_of_ref_2"> <title>This is title 2 of second document in

Remove duplicates from return XQuery

倾然丶 夕夏残阳落幕 提交于 2020-08-07 06:51:32
问题 My XQuery is: declare namespace xsd="http://www.w3.org/2001/XMLSchema"; for $schema in xsd:schema for $nodes in $schema//*, $attr in $nodes/xsd:element/@name where fn:contains($attr,'city') return $attr return: name="city" name="city" name="city" name="city" name="city" When I add distinct-values like: declare namespace xsd="http://www.w3.org/2001/XMLSchema"; for $schema in xsd:schema for $nodes in $schema//*, $attr in $nodes/xsd:element/@name where fn:contains($attr,'city') return distinct

eXist-DB / XQuery - XSL transform unable to set up transformer: no protocol

你离开我真会死。 提交于 2019-12-24 10:22:42
问题 Environment: eXist-db 4.2.1 , XQuery 3.1, XSLT 2.0 I am firing off a transformation of an XML document in eXist-DB - XQuery which produces the following error: exerr:ERROR Unable to set up transformer: no protocol: /db/apps/deheresi/styles/ms609__testxsl-withmodes.xsl [at line 265, column 26] I haven't been able to locate this error in online documentation or searches. It's triggered by this XQuery: declare function document:doc-xsl-docview($node as node(), $model as map(*), $currentdoc as xs

XQuery - output series of HTML elements with separator

南楼画角 提交于 2019-12-24 05:57:30
问题 In XQuery 3.1 I am constructing an HTML table. In one <td> element I'm outputting a series of <a ref=""> . So, currently this simple for : <td> { for $b in collection($globalvar:URIdata)/tei:TEI/tei:text//tei:seg[@type="dep_event" and @corresp = $a/data(@corresp) and @xml:id != $a/data(@xml:id)] order by $b/data(@xml:id) return <a href="{concat($globalvar:URLdoc,$b/ancestor::tei:TEI/tei:text/@xml:id)}">{$b/data(@xml:id)}</a> } </td> Outputs this: <td> <a href="http://localhost:8081/exist/apps

XQuery - output series of HTML elements with separator

泪湿孤枕 提交于 2019-12-24 05:57:09
问题 In XQuery 3.1 I am constructing an HTML table. In one <td> element I'm outputting a series of <a ref=""> . So, currently this simple for : <td> { for $b in collection($globalvar:URIdata)/tei:TEI/tei:text//tei:seg[@type="dep_event" and @corresp = $a/data(@corresp) and @xml:id != $a/data(@xml:id)] order by $b/data(@xml:id) return <a href="{concat($globalvar:URLdoc,$b/ancestor::tei:TEI/tei:text/@xml:id)}">{$b/data(@xml:id)}</a> } </td> Outputs this: <td> <a href="http://localhost:8081/exist/apps

exist-db cardinality for parameter

情到浓时终转凉″ 提交于 2019-12-24 00:37:21
问题 I am new in exist-db and XQuery. In exist-db I have this site map: The catalog "registranten" contains the catalog "data" (with xml-files) and the two files "regBasic.xql" and "regSearch.xql". I am trying to search in the xml-files using the script regSearch.xql: xquery version "3.0"; declare option exist:serialize "method=xhtml media-type=text/html"; declare variable $pageTitle := "Resultat"; declare variable $searchphrase := request:get-parameter("searchphrase", ()); <html> <head> <meta

How to select an attribute by a variable in xquery?

若如初见. 提交于 2019-12-22 12:26:37
问题 I know how to select an attribute like so: $table/@id However how do I do this if the attribute name is stored as a variable. For example: let $x = "id" $table/@[$x] 回答1: You can use the functions local-name or node-name to capture the value of the attribute and match it the predicate. local-name will simply return a string that matches the element name, and node-name will return a fully qualified name, which is generally recommended, but practically speaking, is only necessary if you are

How to select an element by a variable in xquery?

谁都会走 提交于 2019-12-12 03:25:30
问题 I know how to select an element like so: $table/foo However how do I do this if the element name is stored as a variable. For example: let $x = "foo" $table/[$x] I know how do this if it was a property from: How to select an attribute by a variable in xquery? 回答1: This is nearly identical to the answer for the question How to select an attribute by a variable in xquery? but instead of using the attribute selector @* , you would use the element selector, * (or element() ): $table/*[local-name(

Merge XML nodes sharing the same name with “_LIST” in the node name and also at root level

非 Y 不嫁゛ 提交于 2019-12-11 19:15:15
问题 Below is the Input XML and I am looking for the desired output - <xml> <a> <element0>987</element0> </a> <a> <a_list_one> <a_lag_one> <element1>123</element1> <element2>456</element2> </a_lag_one> </a_list_one> <a_list_one> <a_lag_one> <element1>789</element1> <element2>678</element2> </a_lag_one> </a_list_one> <a_list_two> <a_lag_two> <a_list_three> <a_lag_three> <element3>570</element3> <element4>678</element4> </a_lag_three> </a_list_three> <a_list_three> <a_lag_three> <element3>989<

No updating expression allowed Basex

六月ゝ 毕业季﹏ 提交于 2019-12-11 14:31:07
问题 I am using BaseX version 8.6.6 i am getting the error while updating database expression must all be updating or return empty sequence below is the code: declare %private %updating function local:ingest-job() { let $contentpath := 'D:\2019\bloomsbury-ingest-content\TEI.zip' let $archive := file:read-binary($contentpath) for $entry in archive:entries($archive)[fn:ends-with(., '.xml')] let $rootNode := fn:name(fn:parse-xml(archive:extract-text($archive, $entry))/*) return let $docId := fn:parse