Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dizzzz authored and RemiKoutcherawy committed Jan 1, 2018
1 parent 0cd61e8 commit 334154b
Showing 1 changed file with 27 additions and 39 deletions.
66 changes: 27 additions & 39 deletions test/src/xquery/namespaces.xql
Expand Up @@ -15,7 +15,7 @@ function nt:dynamicNSConstr1() {
</test>
};

declare
declare
%test:assertEquals("<test xmlns:foo='http://foo.com'>bla</test>")
function nt:dynamicNSConstr2() {
element { "test" } {
Expand All @@ -24,15 +24,15 @@ function nt:dynamicNSConstr2() {
}
};

declare
declare
%test:assertEquals("<test xmlns:foo1='http://foo.com'/>")
function nt:dynamicNSConstr3() {
<test>
{ namespace { "foo" || 1 } { "http://foo.com" } }
</test>
};

declare
declare
%test:assertEquals("<html xmlns:ev='http://www.w3.org/2001/xml-events'></html>")
function nt:dynamicNSConstr4() {
let $xml :=
Expand All @@ -46,18 +46,18 @@ function nt:dynamicNSConstr4() {
declare %private function nt:copy-ns($node) {
for $prefix in in-scope-prefixes($node)
return
namespace { $prefix } { namespace-uri-for-prefix($prefix, $node) }
namespace { $prefix } { namespace-uri-for-prefix($prefix, $node) }
};

declare
declare
%test:assertEquals('<h:html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml"/>')
function nt:dynamicNSConstrEmptyNS() {
<h:html xmlns:h="http://www.w3.org/1999/xhtml">
{ namespace { "" } { "http://www.w3.org/1999/xhtml" } }
</h:html>
};

declare
declare
%test:assertEquals("<age xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xs:integer'>23</age>")
function nt:dynamicNSConstrAttrib1() {
<age xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> {
Expand All @@ -67,7 +67,7 @@ function nt:dynamicNSConstrAttrib1() {
}</age>
};

declare
declare
%test:assertEquals("<age xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xs:integer'>23</age>")
function nt:dynamicNSConstrAttrib2() {
element age {
Expand All @@ -78,7 +78,7 @@ function nt:dynamicNSConstrAttrib2() {
}
};

declare
declare
%test:assertEquals('<e xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" a="23"/>')
function nt:nscons-001() {
let $s := "http://saxon.sf.net/"
Expand All @@ -93,25 +93,25 @@ function nt:nscons-002() {
let $s := "saxon"
let $xsl := "xsl"
return
<out>
<t:e xmlns:t="http://www.example.com/">{
namespace {""} {"http://saxon.sf.net/"},
attribute a {23},
<out>
<t:e xmlns:t="http://www.example.com/">{
namespace {""} {"http://saxon.sf.net/"},
attribute a {23},
namespace {$xsl} {"http://www.w3.org/1999/XSL/Transform"}, <f/>
}</t:e>
</out>
};

declare
declare
%test:assertEquals('<out><t:e xmlns:t="http://www.example.com/" xmlns="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" a="23"><f xmlns=""/></t:e></out>')
function nt:nscons-003() {
let $s := "saxon"
let $xsl := "xsl"
return
<out>
<t:e xmlns:t="http://www.example.com/">{
namespace {""} {"http://saxon.sf.net/"},
attribute a {23},
<out>
<t:e xmlns:t="http://www.example.com/">{
namespace {""} {"http://saxon.sf.net/"},
attribute a {23},
namespace {$xsl} {"http://www.w3.org/1999/XSL/Transform"}, <f/> }</t:e>
</out>
};
Expand All @@ -122,12 +122,12 @@ function nt:nscons-004() {
let $s := "saxon"
let $xml := "http://www.w3.org/XML/1998/namespace"
return
<out> <t:e xmlns:t="http://www.example.com/" xml:space="preserve">{
namespace xml {"http://www.w3.org/XML/1998/namespace"},
<out> <t:e xmlns:t="http://www.example.com/" xml:space="preserve">{
namespace xml {"http://www.w3.org/XML/1998/namespace"},
attribute a {23}, <f/> }</t:e> </out>
};

declare
declare
%test:assertEquals('<saxon:extension xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" a="23"><f>42</f></saxon:extension>')
function nt:nscons-005() {
let $s := "http://saxon.sf.net/"
Expand All @@ -142,7 +142,7 @@ function nt:nscons-006() {
let $s := "http://saxon.sf.net/"
let $xsl := "http://www.w3.org/1999/XSL/Transform"
return
element {QName("http://saxon.sf.net/", "saxon:extension")}
element {QName("http://saxon.sf.net/", "saxon:extension")}
{ namespace saxon {$s}, attribute a {23}, namespace xsl {$xsl}, namespace saxon {$s}, element f {42} }
};

Expand Down Expand Up @@ -170,15 +170,15 @@ declare function nt:nscons-015() {
<z:e>{ namespace { <a/>/* } { "http://www.w3.org/" } }</z:e>
};

declare
declare
%test:assertError
function nt:dynamicNSConstrError() {
<test>
{ namespace { (1, 2) } { "http://foo.com" } }
</test>
};

declare
declare
%test:assertEquals('<e xmlns:z="http://www.zorba-xquery.com/"/>')
function nt:ns-cons013() {
let $pre := <prefix>z</prefix>,
Expand All @@ -196,7 +196,7 @@ function nt:ns-cons014() {
<e>{ namespace { $pre } { $uri } }</e>
};

declare
declare
%test:assertError("XQDY0074")
function nt:ns-cons016() {
let $pre := <prefix>z:z</prefix>,
Expand All @@ -205,7 +205,7 @@ function nt:ns-cons016() {
<e>{ namespace { $pre } { $uri } }</e>
};

declare
declare
%test:assertError("XQDY0074")
function nt:ns-cons17() {
let $pre := "z z",
Expand All @@ -214,7 +214,7 @@ function nt:ns-cons17() {
<e>{ namespace { $pre } { $uri } }</e>
};

declare
declare
%test:assertError("XPTY0004")
function nt:ns-cons18() {
let $pre := 1,
Expand All @@ -223,7 +223,7 @@ function nt:ns-cons18() {
<e>{ namespace { $pre } { $uri } }</e>
};

declare
declare
%test:assertEquals('<test xmlns:foo="http://foo.com"></test>')
function nt:dynamicNSNodeFromFunc() {
<test>
Expand Down Expand Up @@ -296,15 +296,3 @@ declare
function nt:int-uri-compare() {
5 eq xs:anyURI('5')
};

declare
%test:assertEquals("false")
function nt:right_empty_sequence-date() {
current-date() = ()
};

declare
%test:assertEquals("false")
function nt:right_empty_sequence-boolean() {
false() = ()
};

0 comments on commit 334154b

Please sign in to comment.