This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html SYSTEM "extra-final1.dtd"> | |
| <body [ id=: class="<style = {background:red}"]=[' ::after{color:red} --><style> | |
| .{background:red}[\{background:inherit\}] * {background:F00ML}\. .{background: | |
| red}.\ {background:yellow}.{background:red}[\\][\\='[\\]']{background:purple | |
| }[\]='[\''] {background:#fee} for\([\)]::before{font-family:fantasy;line-height: | |
| 100%;font-size:12vh;font-weight:bold;color:#F00C55;content:'\Akon\A'attr(i)'\A' | |
| attr(\;i);white-space:pre}#\:.\=::after{content:';'attr(--)')';--f:attr(style>)} | |
| .\<style> * {color:blue;padding:4vh;height:25em;width:25em;float:right;}</style> | |
| <d]--(o \='[\]' l"></d]--(o><O)--[b\" class= ><for( i=f00 ;i=C55 ;--i )>--!> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (: new xquery features :) | |
| declare function local:sequence-to-array ($sequence as item()*) as array(*) { | |
| array { $sequence } | |
| }; | |
| declare function local:array-to-sequence ($array as array(*)) as item()* { | |
| $array?* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (: arrows and arrays :) | |
| declare variable $local:test-sequence := ('a','b','d','c'); | |
| declare function local:sequence-to-array ($sequence as item()*) as array(*) { array { $sequence } }; | |
| map { | |
| 'title': 'filter', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare function local:gta50 ($a, $b) { $a > $b}; | |
| declare function local:add22 ($a) { $a + 22}; | |
| declare function local:sum ($result, $next) {$result + $next}; | |
| declare variable $local:sequence := (1,32,34,3,34) | |
| util:log('info', string-join($local:sequence, ',')), | |
| fold-left( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| map:put(map{'a':'asdf'}, 'b', array { 1,2,3,4,map{'a':(2,3)}, array{ 1,2 }, (12) }), | |
| map:put(map{'a':'asdf'}, 'c', array { 1,2,3,4, array{ 1,2 }, (12) }), | |
| map:put( | |
| map:put(map{'a':'asdf'}, 'b', array { 1 }), 'c', array { () }), | |
| map:put(map{'a':'asdf'}, 'c', (1,(2,3), ('asdfas', 'asdfa'))), | |
| map:put(map{'a':'asdf'}, 'b', (1)), | |
| map:put(map{'a':'asdf'}, 'b', ()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare variable $local:testmap := map{'a':'b'}; | |
| declare variable $local:testarray := array{ (0, '1', (1,2,3)) }; | |
| util:log('info', $local:testmap), | |
| util:log('info', ($local:testmap)), | |
| util:log('info', serialize($local:testmap)), | |
| util:log('info', ($local:testmap)?a), | |
| util:log('info', $local:testarray), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| map { | |
| 'title': 'Test 1: only a', | |
| 'pass': ('a', 'b')[.=('a', '2', '3')] = ('a') | |
| }, | |
| map { | |
| 'title': 'Test 2: only b', | |
| 'pass': ('a', 'b')[.=('1', 'b', '3', '4')] = ('b') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare function local:plusOne ($a as xs:integer) { $a + 1 }; | |
| declare function local:greaterThanFive ($a as xs:integer) { $a > 5 }; | |
| declare function local:eachPlusOne ($s as xs:integer*) { | |
| for-each($s, local:plusOne#1) | |
| }; | |
| declare function local:filterGreaterThanFive ($s as xs:integer*) { | |
| filter($s, local:greaterThanFive#1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (:~ | |
| : some examples how to work with sequences and the arrow operator | |
| : using a bit of meta programming | |
| ~:) | |
| (: can be used within a for-each or a local:map :) | |
| declare function local:plusOne ($a as xs:integer) { $a + 1 }; | |
| declare function local:greaterThan ($n as xs:integer, $a as xs:integer) { $a > $n }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (: | |
| : the children of <arrow> and <for-each> must be equal inside <return-element> | |
| : and <wrap-element> | |
| : | |
| : in eXistdb 4.1.0 the contents are not equal in wrap-element | |
| :) | |
| declare variable $local:xml := |