Questions tagged [xquery-3.1]
32 questions
3
votes
3 answers
Why can a numeric literal never be of type xs:positiveInteger in XQuery?
I noticed subtle differences how XQuery implementations handle (sub-)types. Especially, handling of literal numbers as input to functions that have the accepted input type declared.
I naively thought any number literal that is castable to that…

line-o
- 1,885
- 3
- 16
- 33
3
votes
3 answers
Get the reverse order of ancestor nodes with XQuery/XPath
I am searching for a good solution (short expression, best performance) to get the reverse order of all ancestor nodes with XQuery 3.1 on BaseX.
Now i'm using this code, to get dirA/dirA3/dirA31 for the given XML example:
xquery version "3.1"…
user5924595
2
votes
3 answers
Remove specific item in a sequence in XQuery
What is a good way to remove a specific item in a sequence?
I want to remove "b" from the sequence ("a", "b", "c") for example.
("a", "b", "c")
-> do something
-> ("a", "c")
What I know does work is to split the sequence in two and then glue them…

line-o
- 1,885
- 3
- 16
- 33
2
votes
1 answer
Getting the JSON output in an object format for a single record instead of an array using XQuery
I am getting JSON output from an API in an array format(for multiple records) and in object format for a single record. Instead consumer wants to maintain one format - as an array for single record also. Please let me know if there is a way to…

iswariya Kumaravelu
- 23
- 3
2
votes
1 answer
XQuery to remove all elements with attribute onlyChannels="print" from XML file
Trying to remove all elements with attribute onlyChannels="print" from XML Using XQuery
the element with onlyChannels="print" can be anywhere and at different levels.
Input XML

Ahmad Al-Kurdi
- 2,248
- 3
- 23
- 39
2
votes
1 answer
Wrap plain text chunks in P while skipping chunks that are already wrapped in P
I need to wrap all plain text chunks with paragraphs, but there could a nested paragraph which should be skipped. How would I tackle this?
I'm having difficult time understanding how to wrap some plain-text into one paragraph while skipping existing…

HelpNeeder
- 6,383
- 24
- 91
- 155
2
votes
1 answer
Positive lookbehind in xquery
I am writing a Porter stemmer in xQuery and as the first step I need to match consonant and vowel patterns. The consonant matching sequence from the Perl example I'm using as a basis for this is (?:[^aiueoy]|(?:(?<=[aiueo])y)|\by), and the vowel…

medievalmatt
- 427
- 2
- 12
2
votes
1 answer
Is tokenize($s) the same as tokenize($s, ' ')?
https://www.w3.org/TR/xpath-functions/#func-tokenize explains about the single argument version of tokenize:
The one-argument form of this function splits the supplied string at
whitespace boundaries.
and then goes on to define or explain that…

Martin Honnen
- 160,499
- 6
- 90
- 110
2
votes
0 answers
order groups returned by XQuery FLWOR group by clause in document order
Coming from an XSLT background I sometimes struggle to find the XQuery equivalent of some XSLT approach I am used to. This question is about how to order groups in document order, which XSLT 2/3 seems to do automatically while with XQuery the order…

Martin Honnen
- 160,499
- 6
- 90
- 110
2
votes
2 answers
xQuery how to use variables in the path expression
I have an XML document:
10001
Georgi
Facello
10007
…

Judah Flynn
- 544
- 1
- 8
- 20
2
votes
1 answer
Do I need an empty sequence () in addition to a comment in an enclosed expression?
When trying to use the oXygen editor to comment out a node inside of an element oXygen simply wrapped it into (:foo 1 :), but I then found out that that way the node did not get commented out but was rather prefixed by a text node with (:…

Martin Honnen
- 160,499
- 6
- 90
- 110
1
vote
0 answers
Store unwellformed XHTML in Basex DB
I have to store XHTML which is not wellformed e.g.(
) so there is no closing element for element or self close.
I am using the REST service to store data into database, below is the code:
let $$DocPath:= 'D:\sample\'
for $files…

Dharmendra Kumar Singh
- 165
- 8
1
vote
1 answer
How to insert XML Content in db using SQL Module
I am a beginner in XQuery and
I could use some help on how to insert XML elements in my MySQL database. So far, it only inserts pieces of fragments of an xml file but I'd like to fetch the full fragments, including the elements along the…

Salim-dev
- 13
- 2
1
vote
1 answer
XML to CSV with BaseX/XQuery
I'm trying to transform a big number of xmls to a single csv file. A simplified structure of the xml would look like this:
…

Gandalf
- 113
- 8
1
vote
1 answer
Namespaces in XML documents in eXist-db returns empty API calls
I have an eXist-db with a collection of XML documents. All documents have a namespace in the top node which looks like this
When I try to query the documents for…

user3712940
- 39
- 4