namespaces in “x:value-of” are supported

I haven't worked on generative XML for half of month and completely forgot what I'm doing. Fortunately, the last post on this topic suggested the start point: namespaces and variables in the Scheme function "x:value-of".

I've made namespaces working. It was a sort of mystery quest. I dug in the source code of libxslt and succeeded. The source of information were implementations of the XSLT element "value-of" and the EXSLT element "result".

It's easy to support namespaces in XPath evaluation if you have list of namespaces. To get this list, that is the task. Working on it, I reorganized code a bit.

Now I use precompilation for the "s:scheme" extension element. Making it work took a time to find, understand, copy and paste appropriate code. After having it done, everything looks simple.

While doing precompilation of "s:scheme", code creates a special structure, then calculates and stores list of namespaces in the structure. Then the structure is associated with the XSLT element. When xsltproc processes the element, the extension processing function is called with this structure as one of the parameters.

Additionally, I moved getting Scheme code of "s:scheme" to the precompilation step. If Guile supports compilation, I think it's reasonable to compile code too. But it's not required yet.

Now I'm going to add support of variables. First attempt is failed. On the one side I have the list of variables where I need it, but on the other side XPath evaluator ignores variables. Probably some magic initialization function should be used. I'll see later.

Categories: Generative XML

Updated: