[Mono-devel-list] Re: not-so-good patch
atsushi at ximian.com
Thu Feb 10 12:49:15 EST 2005
Ok, and actually after fixing XML declaration output, the rest of
the patch fixes some (well, many) diffs while introducing more new
differentiated results (which does not look like just attribute
ordering but removes expected namespace declarations).
Redesigning is not a big deal. I think we anyways have to change
whitespace handling too. So what I need here is the list of the
problem we have. And next, how to fix, hopefully with patches.
As one point the discussion you pointed out makes sense, yes. If
for now only that point, let's fix the patch not to break other
Andrew Skiba wrote:
> Hello, Atsushi.
> My patch is not so good, because it fixes what is easier to fix, instead
> of fixing the bad design. Let me explain how I think namespaces should
> be processed in XSLT. All processing should be done only on the output
> tree. It's irrelevant when an element is evaluated, what matters is what
> they write to the output. For example xsl:if sometimes will not write
> anything. Today when user declares a namespace, it's processed by the
> first construction that comes after it. In the following example it's
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0" xmlns:n1="n1">
> <xsl:variable name="v">
> <xsl:template match="/" xmlns:n2="n2">
> <aaa xmlns:n3="n3">
> <bbb xmlns:n4="n4" xmlns:n1="n1"/>
> <xsl:copy-of select="$v"/>
> <aaa xmlns:n3="n3">
> <bbb xmlns:n4="n4" xmlns:n1="n1" />
> <ccc xmlns:n1="n1" />
> instead of
> <aaa xmlns:ns1="ns1" xmlns:n2="n2" xmlns:n3="n3">
> <bbb xmlns:ns4="ns4" />
> <ccc xmlns:ns1="ns1" />
> If you add here included and imported stylesheets with other namespaces
> declared in them, the situation will be much worse.
> But namespace processing should look simple.
> 1. On the compilation stage every compiled element gets the full list of
> all namespaces, declared in it and its parents.
> 2. When an element is written to the output, it gets the list of the
> compiled element that writes it.
> 3. From the list of namespaces you hide standard ones and those that
> were already written for the parents in the output tree. The rest you
> write out.
> Nothing complicated. I don't mention here namespaces that come from
> attributes and the input XML, as their processing does not change my idea.
> Andrew Skiba.
More information about the Mono-devel-list