Re: [xslt] xsl:element namespace query



On Thu, May 23, 2002 at 12:08:14PM +0100, Richard Jinks wrote:
> From: "Daniel Veillard" <veillard@redhat.com>
> 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>

   Hum, that's a problem in general, if you make the namespace the default one
this can impact a lot of things. Just imagine that instead of 111 you have
a QName value in the BBB node, generating a default namespace can alter
the semantic of the generated content, in ways that are *not* verifiable
by the XSLT processor. So "generated" namespace prefixes must not be empty
they really must be as unique as possible !

>  <?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>

  that's fine

> 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?

  No, my point is that if one of the parent of the generated node
hold a declaration for the namespace used then the serialization should
reuse the associated prefix. If one application relies on the actual
prefix value and does not check the associated URI then it's simply
not namespace compliant, please ditch it ! Sorry for being pedantic
but there are just too many broken code out there (sometimes mine ;-)
and cleaning the crap is a healthy thing !

> Any preference to either of the two example styles?

  Definitely not the first one ! 

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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