Re: [xslt] xsl:element namespace query



From: "Daniel Veillard" <veillard@redhat.com>
> >
> > My query stems from not expecting libxslt to be this clever and merge
the
> > namespaces together into one namespace declaration on the parent AAA
> > element. I was expecting the more literal "simple" output (as with Saxon
and
> > MSXSL) with the namespace declaration sat on the elements they were
declared
> > with in the stylesheet.
>
>   I can't recall how/why the namespace declaration got moved that way.
> One thing is sure, when generating a output node in the tree within a
namespace
> if that namespace has already a declaration in scope, then libxslt will
reuse
> it an not regenerate a declaration again. That's something which I think
makes
> sense, and would not like it to be changed.
>

> ...
>
> > On a related node, if I did have to modify the code would you be
interested
> > in reflecting the change back into libxslt, or are you happy with the
way it
> > works / have a reason for preferring things as they are?
>
>   With the revision 1.0 of the namespace spec I don't see how this
> can be a problem, but with 1.1 where prefix scope can be cancelled at
> a given node level, then the fact of up'ing the declaration one level
> up can become a serious problem, and from that point of view that ought
> to be fixed to be future proof.
>

I'll change the code to move the namespace down to the children elements.

wrt regenerating declarations, I think I understand what you mean, but just
to make sure:

As xmlNodeDumpOutput will always output a namespace prefix if one is
defined,
either of the following outputs are acceptable:

 <?xml version="1.0" encoding="utf-8"?>
 <AAA>
    <BBB xmlns="http://zvon.org/xslt";>111</BBB>
    <XXX xmlns="http://zvon.org/xslt";>555</XXX>
    <XXX xmlns="http://zvon.org/xslt";>555</XXX>
 </AAA>

 <?xml version="1.0" encoding="utf-8"?>
 <AAA>
    <ns1:BBB xmlns:ns1="http://zvon.org/xslt";>111</ns1:BBB>
    <ns1:XXX xmlns:ns1="http://zvon.org/xslt";>555</ns1:XXX>
    <ns1:XXX xmlns:ns1="http://zvon.org/xslt";>555</ns1:XXX>
 </AAA>

In order to keep the qqq: prefix on the last node would require duplicating
the namespace node, one with the prefix, one without. It is this that you're
not keen on?
(i.e. just having a different prefix isn't enough to differentiate the
declarations of the namespaces)

Any preference to either of the two example styles?

Thanks,
Richard



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]