links, trees, forest, infinity

On mapping from Scheme values to libxml nodes. It is reasonable to map the same physical values to the same physical nodes. But it causes unexpected results. Consider the stylesheet:

  xmlns:x = ""
  xmlns:s = ""
  version     = "1.0">

  (define foo 777)

<x:template match="/">
    <!-- <y><s:scheme>foo</s:scheme></y> -->


One can expect to get the following result:


But the right answer is:


As I found, libxml performs a set of checks while adding a child. One of the checks is that the same node isn't inserted twice.

And what happens when the part of stylesheet is uncommented? It produces such a tree structure which isn't expected by libxml. As result, serializer enters infinitive loop till core dump.

Categories: Generative XML