Steven Pemberton
Namespaces are a property of XML, and not of ixml.
Although generating particular forms of XML was a non-aim of ixml, there are still people who would like to generate XML with namespaces from ixml.
Namespace declarations deliberately look like an attribute in XML: in that way non-namespace-aware XML processors can still read the XML.
Namespace-aware processors recognise these special attribute-looking things from the initial "xmlns" of the namespace declaration, and then treat them specially.
To include namespaces in ixml serialisation, you can use rule renaming. For instance:
html: xf-namespace-declaration, default-namespace, head, body.
@default-namespace>"xmlns": +"http://www.w3.org/1999/xhtml".
@xf-namespace-declaration>"xmlns-xf": +"http://www.w3.org/2002/xforms".
head: {whatever}.
body: {whatever}.
which would generate:
<html xmlns:xf='http://www.w3.org/2002/xforms' xmlns='http://www.w3.org/1999/xhtml'> <head>...</head> <body>...</body> </html>
For ixml processors that generate textual XML output, this will work fine; ixml processors that serialise directly to in-memory XML will need to do the same thing as XML processors, and recognise 'attributes' that begin with "xmlns" and treat them specially.
bibliography: xl, biblioentry*.
@xl>"xmlns:xl": +"http://www.w3.org/1999/xlink".
biblioentry: abbrev, (author; editor), -", ", title, -", ",
publisher, -", ", pubdate, -", ",
(artpagenums, -", ")?,
(bibliomisc; biblioid)**-", ", -#a.
abbrev: -"[", ~["]"; #a]+, -"] ".
author: personname++-" and ".
editor: personname, -" (ed.)".
personname: firstname, -" ", surname, " et al."?.
firstname: [L; "."]+.
surname: ([L]; ". ")+.
title: ~[",]"; #a]+.
publisher: ~[",]"; #a]+.
pubdate: ~[",]"; #a]+.
bibliomisc: link+.
link: href.
@href>"xl:href": ("http:"; "https:"), [L; Nd; "/.~--#=?"]+.
biblioid: class, ~[",]"; #a]+.
@class: "ISBN", -" "; "doi", -":".
artpagenums: -"pp ", [Nd; "-–"]+.
<bibliography xmlns:xl='http://www.w3.org/1999/xlink'>
<biblioentry>
<abbrev>spec</abbrev>
<editor>
<personname>
<firstname>Steven</firstname>
<surname>Pemberton</surname>
</personname>
</editor>
<title>Invisible XML Specification</title>
<publisher>invisiblexml.org</publisher>
<pubdate>2022</pubdate>
<bibliomisc>
<link xl:href='https://invisiblexml.org/ixml-specification.html'/>
</bibliomisc>
</biblioentry>
</bibliography>