Questions tagged [xquery-3.0]

Use this tag for questions specific to XQuery version 3.0 and no other version.

XQuery 3.0 introduces the following new features:

  • Functions are first-class items which can be passed as parameters to other functions

  • Functions and variables support public and private annotations

  • Union types are allowed in function arguments

  • XML Schema 1.1 is supported

  • Clauses added to FLWOR expressions:

    • group by: assigns tuples in the input tuple stream to a group, returns a tuple for each group

    • tumbling window: destructing assignment of a sequence during iteration without intersection

    • sliding window: destructing assignment of a sequence during iteration with intersection

    • count clause: binds a variable to the position in each tuple in the tuple stream

    • allowing empty: facilitates outer joins as in SQL

  • decimal format declaration: adds a decimal format to the statically known decimal formats

  • try/catch expressions: allows for user defined recovery from errors

  • switch expressions: allows for user defined branching logic

References

159 questions
10
votes
1 answer

Return multiple values from multiple inputs in XQuery 3.0?

I've tried a few things: for $name in ('Hanz', 'Heinz', 'Hans', 'Huns', 'Hund') where $name contains text 'Hans' using fuzzy return $name | $name (: returns error: Stopped at line 3, column 20: [XPTY0004] Union expression: node() expected,…
Wolfpack'08
  • 3,982
  • 11
  • 46
  • 78
5
votes
2 answers

How to create an if statement without an else in XQuery?

I wish to create an if statement without an else portion in XQuery. For example: { if (5 = 5) then } How do I do this? I also tried this: { if (5 = 5) then else …
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
5
votes
3 answers

Remove duplicates from return XQuery

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"…
Peter Fašianok
  • 153
  • 1
  • 1
  • 8
4
votes
2 answers

Why is the XQuery expression returning the wrong element count?

I want return the number of L1 and L0 items per schedule and also the number of warnings, also per schedule. It is actually a "count if" situation. I tried the following XQuery, which counts L1, L0 and warnings fine, but does count all warnings…
Maik
  • 43
  • 4
4
votes
1 answer

How to use "if statements" in "let" statements in xquery

I wish to do the following: let $foo := if (5 = 5) then return else return But unfortunately the above doesn't work. How do I do if statments for let statements.
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
4
votes
1 answer

Creating a map in XQuery

I am trying to create a hash-map/ key-value pair like structure in xquery. I am aware a map like structure exists in xquery: http://www.w3.org/2005/xpath-functions/map/ and even found documentation in Saxon:…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
4
votes
1 answer

Recursively wrapping up an element

Say I have an element x and some empty elements (, , ), and I want to wrap up the first inside the second one at a time, resulting in x. How do I go about this when I don't know the number of the empty…
4
votes
1 answer

How to use XQuery in DotNet

I am developing project for that i want to apply some xqueries on XML file and get the data from XML, but i don't understand how to use XQuery in dotnet. Is there any alternative for XQuery in dotnet Please help me.
Raviteja Chekuri
  • 97
  • 1
  • 1
  • 6
4
votes
1 answer

XQuery Full Text search with Word1 and NOT Word2

Following is the XML Structure - Doc 1 This is a special note section. This B Tag is used for highlighting any text and is optional
John
  • 2,820
  • 3
  • 30
  • 50
3
votes
1 answer

How can i remove emoji's from text using xquery

I have a $text = "Hello üäö$" I wanted to remove just emoji's from the text using xquery. How can i do that? expected result : "Hello üäö$" i tried to use: replace($text, '[^\x00-\xFFFF]', '') but didn't work. Thanks in advance :)
3
votes
1 answer

Can I get the name of the current XQuery function?

From an XQuery program I want to log the name of the current function. Is there a way to get the name of the current function without throwing an exception? I can get the function information by throwing an exception and logging stack frame…
3
votes
1 answer

XQuery returns items not in set

I am writing some XQuery on the following document: ... ... ... …
Shane McGarry
  • 513
  • 1
  • 6
  • 19
3
votes
1 answer

fn:replace to return one string on iteration

I am looking to implement a find and replace for a string from a document by using the key and value pair of a map. The code I currently have seems to be returning 2 strings because of 2 map values. I am looking to return one string with values in…
SteeleDev
  • 169
  • 1
  • 3
  • 12
3
votes
2 answers

How to prevent additional spaces when serializing XML to text (csv)

My goal is to generate a CSV file out of XML using Saxon. When running the (simplified!) xquery below in Saxon (PE, 9.7.0.15), in the result for each line after the first result line, an additional space is added: declare namespace output =…
DiZzZz
  • 621
  • 3
  • 12
3
votes
1 answer

Difference between data() and string()

What is the practical difference between the data() function and the string() function in Xquery? It seems they both return the same results when I use them. Can someone give me a simple example of how they are different? let $dataset := …
aashtonk
  • 789
  • 7
  • 15
1
2 3
10 11