Commit c777a2ee authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-07-02 23:00:14 by cvscast] Empty log message

Original author: cvscast
Date: 2003-07-02 23:00:14+00:00
parent 641543bc
...@@ -33,33 +33,47 @@ XML documents ...@@ -33,33 +33,47 @@ XML documents
</p> </p>
<sample> <sample>
&lt;p:a q:x="3" xmlns:p="http://a.com" xmlns:q="http://b.com"/> &lt;p:a q:c="3" xmlns:p="http://a.com" xmlns:q="http://b.com"/>
</sample> </sample>
<p> <p>
can be written in CDuce: can be written in CDuce:
</p> </p>
<sample>
namespace p = "http://a.com" in
namespace q = "http://b.com" in
&lt;p:a q:c="3">[]
</sample>
<p>
This element can be bound to a variable
<code>x</code> by a <code>let</code> binding as follows
</p>
<sample> <sample>
let x = let x =
namespace p = "http://a.com" in namespace p = "http://a.com" in
namespace q = "http://b.com" in namespace q = "http://b.com" in
&lt;p:a q:a="3">[] &lt;p:a q:c="3">[]
</sample> </sample>
<p> <p>
In which case the namespace declarations are local to the scope
of the let.
<br></br>
Alternatively, it is possible to use global prefix bindings: Alternatively, it is possible to use global prefix bindings:
</p> </p>
<sample> <sample>
namespace p = "http://a.com" namespace p = "http://a.com"
namespace q = "http://b.com" namespace q = "http://b.com"
let x = &lt;p:a q:a="3">[] let x = &lt;p:a q:c="3">[]
</sample> </sample>
<p> <p>
Similarly, CDuce supports namespace defaulting. This is introduced Similarly, CDuce supports namespace <i>defaulting</i>. This is introduced
with a local or global <code>namespace "..."</code> construction. by a local or global <code>namespace "..."</code> construction.
As in the XML, default namespace applies only to tags (atoms), not As in the XML, default namespace applies only to tags (atoms), not
attributes (record labels). attributes (record labels).
For instance, in the expression <code>namespace "A" in &lt;x For instance, in the expression <code>namespace "A" in &lt;x
...@@ -74,7 +88,7 @@ other, the current set of global bindings. ...@@ -74,7 +88,7 @@ other, the current set of global bindings.
</box> </box>
<box title="Types for atom" link="types"> <box title="Types for atoms" link="types">
<p> <p>
The type <code>Atom</code> represents all the atoms, in all the The type <code>Atom</code> represents all the atoms, in all the
...@@ -95,7 +109,7 @@ in the current default namespace. ...@@ -95,7 +109,7 @@ in the current default namespace.
<p> <p>
When used as atoms and not tags, the singleton types When used as atoms and not tags, the singleton types
and ``any in namespace'' types must be prefixed by an antiquote, and ``any in namespace'' types must be prefixed by an backquote,
as for atom values: <code>`p:x, `p:*, `.:*</code>. as for atom values: <code>`p:x, `p:*, `.:*</code>.
</p> </p>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment