| 33 |
</p> |
</p> |
| 34 |
|
|
| 35 |
<sample> |
<sample> |
| 36 |
<p:a q:x="3" xmlns:p="http://a.com" xmlns:q="http://b.com"/> |
<p:a q:c="3" xmlns:p="http://a.com" xmlns:q="http://b.com"/> |
| 37 |
</sample> |
</sample> |
| 38 |
|
|
| 39 |
<p> |
<p> |
| 41 |
</p> |
</p> |
| 42 |
|
|
| 43 |
<sample> |
<sample> |
| 44 |
|
namespace p = "http://a.com" in |
| 45 |
|
namespace q = "http://b.com" in |
| 46 |
|
<p:a q:c="3">[] |
| 47 |
|
</sample> |
| 48 |
|
|
| 49 |
|
<p> |
| 50 |
|
This element can be bound to a variable |
| 51 |
|
<code>x</code> by a <code>let</code> binding as follows |
| 52 |
|
</p> |
| 53 |
|
|
| 54 |
|
<sample> |
| 55 |
let x = |
let x = |
| 56 |
namespace p = "http://a.com" in |
namespace p = "http://a.com" in |
| 57 |
namespace q = "http://b.com" in |
namespace q = "http://b.com" in |
| 58 |
<p:a q:a="3">[] |
<p:a q:c="3">[] |
| 59 |
</sample> |
</sample> |
| 60 |
|
|
| 61 |
<p> |
<p> |
| 62 |
|
In which case the namespace declarations are local to the scope |
| 63 |
|
of the let. |
| 64 |
|
<br></br> |
| 65 |
Alternatively, it is possible to use global prefix bindings: |
Alternatively, it is possible to use global prefix bindings: |
| 66 |
</p> |
</p> |
| 67 |
|
|
| 68 |
<sample> |
<sample> |
| 69 |
namespace p = "http://a.com" |
namespace p = "http://a.com" |
| 70 |
namespace q = "http://b.com" |
namespace q = "http://b.com" |
| 71 |
let x = <p:a q:a="3">[] |
let x = <p:a q:c="3">[] |
| 72 |
</sample> |
</sample> |
| 73 |
|
|
| 74 |
<p> |
<p> |
| 75 |
Similarly, CDuce supports namespace defaulting. This is introduced |
Similarly, CDuce supports namespace <i>defaulting</i>. This is introduced |
| 76 |
with a local or global <code>namespace "..."</code> construction. |
by a local or global <code>namespace "..."</code> construction. |
| 77 |
As in the XML, default namespace applies only to tags (atoms), not |
As in the XML, default namespace applies only to tags (atoms), not |
| 78 |
attributes (record labels). |
attributes (record labels). |
| 79 |
For instance, in the expression <code>namespace "A" in <x |
For instance, in the expression <code>namespace "A" in <x |
| 88 |
|
|
| 89 |
</box> |
</box> |
| 90 |
|
|
| 91 |
<box title="Types for atom" link="types"> |
<box title="Types for atoms" link="types"> |
| 92 |
|
|
| 93 |
<p> |
<p> |
| 94 |
The type <code>Atom</code> represents all the atoms, in all the |
The type <code>Atom</code> represents all the atoms, in all the |
| 109 |
|
|
| 110 |
<p> |
<p> |
| 111 |
When used as atoms and not tags, the singleton types |
When used as atoms and not tags, the singleton types |
| 112 |
and ``any in namespace'' types must be prefixed by an antiquote, |
and ``any in namespace'' types must be prefixed by an backquote, |
| 113 |
as for atom values: <code>`p:x, `p:*, `.:*</code>. |
as for atom values: <code>`p:x, `p:*, `.:*</code>. |
| 114 |
</p> |
</p> |
| 115 |
|
|