In some data models we have no link to the parent and ancestors. The article "On parent pointers in SXML trees" <
http://okmij.org/ftp/Scheme/xml.html#parent-ptr> discusses and compares five different methods of determining the parent of an SXML node.
The axis "preceding-sibling" can be calculated having the parent and children of the parent.
In some models nodes have direct links to the root.
In models with fast parent links we can calculate the root as "parent(parent(...))".
In the base SXML model I see these ways:
I prefer usage of bindings. Usage of callback implies use of globals or passing additional parameters to combinators and filters. Bindings can be considered as a sort of substitutions performed by a Scheme compiler, and it might be more efficient.
The solution with bindings can be applied to variables.
Result of the "document(node)" should be the same as the result of the "document(root(node))". Let use the latter.
Any XSLT processor implements the "node-set" extension. But it will be hardly possible with our implementation. It works on some tree binding which is incompatible with the SXML representation.
Consider XSLT fragment:
<myelem> <xsl:copy-of select="node()|@*"/> </myelem>
XSLT processor should somehow distinguish usual nodes and attributes nodes in the result of the "node()|@*".
The same XML nodes should be "eq?". But it's not so easy for attribute and namespace nodes. To be discussed in an upcoming article.
To implement XSLT, node sets should contain nodes in the document order.