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

« back to all changes in this revision

Viewing changes to test/rbkt/Queries/zorba/xqxq/uri-mapper.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
declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';
 
4
declare namespace mapper = 'http://www.zorba-xquery.com/modules/xqxq/uri-mapper';
 
5
declare namespace op = "http://www.zorba-xquery.com/options/features";
 
6
declare namespace f = "http://www.zorba-xquery.com/features";
 
7
declare option op:enable "f:hof";
 
8
 
 
9
declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {
 
10
  if($namespace = 'http://foo')
 
11
  then "module namespace test = 'http://test'; declare function test:foo(){'foo'};"
 
12
  else ()
 
13
};
 
14
 
 
15
declare function mapper:uri-mapper($namespace as xs:string, $entity as xs:string)
 
16
{
 
17
   if($namespace = 'http://test')
 
18
   then 'http://foo'
 
19
   else ()
 
20
};
 
21
 
 
22
variable $queryID := xqxq:prepare-main-module
 
23
(
 
24
  "import module namespace test = 'http://test'; test:foo()", 
 
25
  resolver:url-resolver#2, mapper:uri-mapper#2
 
26
);
 
27
xqxq:evaluate($queryID)