XSieve supports the both forms of the SXML representation of namespaces: with prefix and with URI.
Example 6. Different kinds of presentation of namespaces
SXML using prefixes
(foo:bar (@ (@ (*NAMESPACES* (foo "http://xsieve.sourceforge.net/foo")))))
SXML using URIs
(http://xsieve.sourceforge.net/foo:bar (@ (@ (*NAMESPACES* (http://xsieve.sourceforge.net/foo "http://xsieve.sourceforge.net/foo" foo)))))
The form with prefix is preferred. Moreover, automatic conversion from XML to SXML always produces the form with prefix.
To represent a default namespace, XSieve uses the optional
original-prefix feature of SXML. The value of the original prefix is the symbol
Example 7. Representing a default namespace
<foo xmlns="http://xsieve.sourceforge.net/foo"> <bar/> </foo>
(z:foo (@ (@ (*NAMESPACES* (z "http://xsieve.sourceforge.net/foo" *DEFAULT*)))) (z:bar))
The danger of the form with prefix is that the prefixes can be "hanging".
Manipulating SXML fragments with hanging prefixes, one can create an incorrect output document. Possible errors:
prefix is not defined at all,
prefix is defined, but its URI is different.
It's task of an XSieve developer to avoid such problems. XSieve doesn't try to prevent them.
Fortunately, hanging prefixes are not so bad. XSieve tries to resolve the prefixes when converting from SXML to XML. Such conversion is usually performed when XSieve have finished execution of Scheme code and going to put the result to the output tree. It is very likely that the output tree has a namespace declaration for the prefix.
As a summary, here is a set of guidelines for using namespaces.
Use the form with prefix, not the form with URI.
Declare all namespaces of the output document in the top-level element.
Avoid using the same prefixes for different URIs.