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
0
votes
1 answer

XQuery: Update variable value in loop after return

How can we Update the variable value in a loop after the return? let $daysList := (1 to functx:days-in-month(xs:date(xs:date(current-date())))) let $temp:=0 for $day in $daysList for $x in doc("booking2.xml")/bookings/booking where $x/roomNo =…
Ganesh
  • 81
  • 1
  • 12
0
votes
1 answer

recursive replacement

How to find all the empty string and replace it with 'empty' element in xquery without using xquery updating. I achieved this using xquery update but I want to get without using update.
SS2
  • 3
  • 2
0
votes
2 answers

xQuery remove non selected elements

I have an XML document named employees.xml: 10001 Georgi Facello 10002
Judah Flynn
  • 544
  • 1
  • 8
  • 20
0
votes
1 answer

Select range of elements in XQuery 3.0

I have the following xml data structure ... and so on I want to select leg elements…
swshaun
  • 384
  • 1
  • 4
  • 12
0
votes
2 answers

xQuery how to merge two list into one?

I have an XML document: 10001 Georgi Facello 10002
Judah Flynn
  • 544
  • 1
  • 8
  • 20
0
votes
3 answers

How can I know which is the most populated city in this XML?

I have a XML like this: Vienna 1583000
TheRedosan
  • 79
  • 2
  • 12
0
votes
2 answers

How to use XQuery to transform consecutive tags into nested tags or table

I have an XML file with consecutive tags instead of nested tags, like the following: <subtitle> <topic att="TopicTitle">Topic title 1</topic> <content att="TopicSubtitle">topic subtitle 1</content> <content…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xpath" class="post-tag grid--cell" title="show questions tagged 'xpath'" rel="tag">xpath</a> <a href="../../questions/tagged/xquery" class="post-tag grid--cell" title="show questions tagged 'xquery'" rel="tag">xquery</a> <a href="../../questions/tagged/xquery-3.0" class="post-tag grid--cell" title="show questions tagged 'xquery-3.0'" rel="tag">xquery-3.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Oct 11 '17 at 18:25">asked Oct 11 '17 at 18:25</time> <a href="../../users/1607443/chuytm" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1607443.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="ChuyTM" /> </a> <div class="s-user-card--info"> <a href="../../users/1607443/chuytm" class="s-user-card--link">ChuyTM</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">292</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="3 silver badge">3</li> <li class="s-award-bling s-award-bling__bronze" title="7 bronze badge">7</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-43221926"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>0</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/43221926/how-to-output-xml-node-with-same-name-multiple-occurrences-using-an-xquery" class="question-hyperlink">How to output XML node with same name[multiple occurrences] using an XQuery</a></h3> <div class="excerpt">My XML Response Load appears as below <entries> <id>1</id> <UseCountIds>100</UseCountIds> <UseCountIds>200</UseCountIds> <UseCountIds>300</UseCountIds> </entries> Here 'entries' is…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xquery" class="post-tag grid--cell" title="show questions tagged 'xquery'" rel="tag">xquery</a> <a href="../../questions/tagged/xquery-sql" class="post-tag grid--cell" title="show questions tagged 'xquery-sql'" rel="tag">xquery-sql</a> <a href="../../questions/tagged/xquery-3.0" class="post-tag grid--cell" title="show questions tagged 'xquery-3.0'" rel="tag">xquery-3.0</a> <a href="../../questions/tagged/xquery-update" class="post-tag grid--cell" title="show questions tagged 'xquery-update'" rel="tag">xquery-update</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 05 '17 at 04:37">asked Apr 05 '17 at 04:37</time> <a href="../../users/6526579/tom-george" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/6526579.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Tom George" /> </a> <div class="s-user-card--info"> <a href="../../users/6526579/tom-george" class="s-user-card--link">Tom George</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">29</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="1 silver badge">1</li> <li class="s-award-bling s-award-bling__bronze" title="7 bronze badge">7</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-41793843"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>0</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/41793843/xquery-sum-of-values" class="question-hyperlink">Xquery sum of values</a></h3> <div class="excerpt">I've got this part of code: <recipe> { for $r in doc("retete.xml")//recipe return <rec title="{$r/title}">{ <item>{ for $r3 in doc("listaPreturi.xml")//produs for $r2 in $r/ingredients/ingredient where $r2/@name = $r3/@denumire …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/sum" class="post-tag grid--cell" title="show questions tagged 'sum'" rel="tag">sum</a> <a href="../../questions/tagged/xquery" class="post-tag grid--cell" title="show questions tagged 'xquery'" rel="tag">xquery</a> <a href="../../questions/tagged/xquery-3.0" class="post-tag grid--cell" title="show questions tagged 'xquery-3.0'" rel="tag">xquery-3.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 22 '17 at 17:14">asked Jan 22 '17 at 17:14</time> <a href="../../users/3052078/user3052078" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/3052078.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="user3052078" /> </a> <div class="s-user-card--info"> <a href="../../users/3052078/user3052078" class="s-user-card--link">user3052078</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">487</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="8 silver badge">8</li> <li class="s-award-bling s-award-bling__bronze" title="20 bronze badge">20</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-38447985"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>0</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/38447985/how-to-output-xml-node-with-same-name-multiple-occurrences-but-different-value" class="question-hyperlink">How to output XML node with same name[multiple occurrences] but different values using an XQuery</a></h3> <div class="excerpt">I have a requirement where an XML element node say 'UseCountIds' having multiple occurrences and with multiple values . As element node name remain same, I need to distinguish each of these as UseCountIds1,UseCountIds2,UseCountIds3. As of now, it is…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xml-parsing" class="post-tag grid--cell" title="show questions tagged 'xml-parsing'" rel="tag">xml-parsing</a> <a href="../../questions/tagged/xquery" class="post-tag grid--cell" title="show questions tagged 'xquery'" rel="tag">xquery</a> <a href="../../questions/tagged/xquery-sql" class="post-tag grid--cell" title="show questions tagged 'xquery-sql'" rel="tag">xquery-sql</a> <a href="../../questions/tagged/xquery-3.0" class="post-tag grid--cell" title="show questions tagged 'xquery-3.0'" rel="tag">xquery-3.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jul 19 '16 at 00:52">asked Jul 19 '16 at 00:52</time> <a href="../../users/6526579/tom-george" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/6526579.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Tom George" /> </a> <div class="s-user-card--info"> <a href="../../users/6526579/tom-george" class="s-user-card--link">Tom George</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">29</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="1 silver badge">1</li> <li class="s-award-bling s-award-bling__bronze" title="7 bronze badge">7</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-38090952"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>0</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/38090952/how-to-output-some-xml-optional-elements-nodes-always-using-xquery" class="question-hyperlink">How to output some XML optional elements/nodes always using XQUERY</a></h3> <div class="excerpt">I have a requirement where I need to output optional XML elements always (irrespective of data availability) , while writing into a .csv file. XML File Format <entries> <countryCode>123</countryCode> <adminDataMap> …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xquery" class="post-tag grid--cell" title="show questions tagged 'xquery'" rel="tag">xquery</a> <a href="../../questions/tagged/xquery-sql" class="post-tag grid--cell" title="show questions tagged 'xquery-sql'" rel="tag">xquery-sql</a> <a href="../../questions/tagged/xquery-3.0" class="post-tag grid--cell" title="show questions tagged 'xquery-3.0'" rel="tag">xquery-3.0</a> <a href="../../questions/tagged/xquery-update" class="post-tag grid--cell" title="show questions tagged 'xquery-update'" rel="tag">xquery-update</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 29 '16 at 05:21">asked Jun 29 '16 at 05:21</time> <a href="../../users/6526579/tom-george" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/6526579.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Tom George" /> </a> <div class="s-user-card--info"> <a href="../../users/6526579/tom-george" class="s-user-card--link">Tom George</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">29</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="1 silver badge">1</li> <li class="s-award-bling s-award-bling__bronze" title="7 bronze badge">7</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-36617323"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>0</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/36617323/why-does-comma-appear-in-my-xquery-and-how-to-get-rid-of-it" class="question-hyperlink">Why does comma appear in my Xquery and how to get rid of it?</a></h3> <div class="excerpt">I have an xml file which looks like this. <Movies> <Movie> <Title>1 2 3 1985 I am trying to run this xquery. let $alltitles := Movies//Movie/Title let $allyear :=…
user2775042
  • 509
  • 2
  • 6
  • 21
0
votes
2 answers

XQuery tumbling windows: how to match first occurrence of a grouping key?

I have a CSV file of an SQL dump, and I am working with it in BaseX 8.4. The CSV headers contain a flattened representation of the SQL table structure. CSV with header and first…
tat
  • 321
  • 1
  • 19
0
votes
1 answer

How to use the "!" in for complex "for" statements in XQuery?

I know how to use the new "!" in simple for loops like so: $t2/Course ! map {./SubjectId : .} But how do you use this new "!" in more complex for statements that contain "lets" and "groups" like this: for $e2 in $t2/Course let $foreignId :=…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
0
votes
1 answer

How to do an efficient Outer or Left join in XQuery?

I have the following data: 1 Maths 2 Science 2
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231