~zorba-coders/zorba/image-module-head

« back to all changes in this revision

Viewing changes to test/rbkt/Queries/zorba/xqxq/url-schema-resolver2.xq

  • Committer: Zorba Build Bot
  • Author(s): chillery+launchpad at lambda
  • Date: 2012-10-26 15:13:54 UTC
  • mfrom: (11110.1.2 move-xqxq-core)
  • Revision ID: chillery+buildbot@lambda.nu-20121026151354-ojxq78uovjc6czno
Moved XQXQ into Zorba core. Approved: Juan Zacarias, Matthias Brantner, Chris Hillery

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';
 
2
 
 
3
import module namespace ddl =
 
4
    "http://www.zorba-xquery.com/modules/store/dynamic/collections/w3c/ddl";
 
5
import module namespace dml =
 
6
    "http://www.zorba-xquery.com/modules/store/dynamic/collections/w3c/dml";
 
7
 
 
8
declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';
 
9
declare namespace op = "http://www.zorba-xquery.com/options/features";
 
10
declare namespace f = "http://www.zorba-xquery.com/features";
 
11
declare option op:enable "f:hof";
 
12
 
 
13
declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {
 
14
  if ($entity = 'schema')
 
15
  then
 
16
    dml:collection("http://www.zorba-xquery.com/modules/xqxq")//xs:schema[@targetNamespace=$namespace]
 
17
  else
 
18
    ()
 
19
};
 
20
 
 
21
declare variable $coll := "http://www.zorba-xquery.com/modules/xqxq";
 
22
declare variable $schema := doc("test.xsd");
 
23
ddl:create($coll);
 
24
 
 
25
dml:apply-insert-nodes-first($coll, $schema);
 
26
variable $query-key := xqxq:prepare-main-module(
 
27
  "import schema namespace test = 'http://test'; validate {<test:test><test:subtest>a</test:subtest><test:subtest2>a</test:subtest2></test:test>}",
 
28
  resolver:url-resolver#2, ());
 
29
xqxq:evaluate($query-key)