Re: [xml] empty xmlns attributes



I've worked out there is some sort of "namespace scoping" going on.  But
I couldn't have put it into words until you just did.  However, the fact
that my `<a href"...' wasn't comming out with the empty attribute didn't
make sense to me.

I just upgraded to 
    libxml2-2.5.3
    libxslt-1.0.26
And now it's comming out like this:

    <a xmlns="http://www.w3.org/1999/xhtml"; href="

Which is not what I would have expected.  But now I see that everyhitng
generated by my stylesheet has the correct namespace.  It's everything
in my src document which has no namespace.

So if I move the incorrectly places `xmlns' attribute in my source
document...

    <document xmlns="http://www.w3.org/1999/xhtml"; title....

and....  enlightenment.

Now the question is "How to get the stylesheet to assume a namespace if
none is given?"

But I think that would best be left for another time...

Thanks for the help.

* Daniel Veillard <veillard redhat com> [2003-02-12 17:59:49 GMT]:
On Tue, Feb 11, 2003 at 11:21:15PM +0000, Peter McGarvey wrote:

The weirdest thing is that my theory works for me, but doesn't apply 
to your example, because you get correct xmlns in your <a> tags:


  Your stylesheet puts the root html element in the XHTML namespace as
the default namespace. If you later generate XHTML element but without
namespace in the stylesheet, libxslt will do what you asked for and
as a result MUST eliminate the default namespace, and does that by
outputting xmlns="" which is the *only* way to do what you ask it to do.
Soultion is to NOT ask the stylesheet to generate XHTML element without
namespace, and make 100% sure in your staylesheet that all generated
element are in the default XHTML namespace.
   You MUST read and understand the following spec before solving your
problem:
      http://www.w3.org/TR/REC-xml-names/

  <p> and <p> can represent TOTALLY different things depending on the
default namespace context.

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/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml


-- 
TTFN, FNORD

Peter McGarvey
Freelance FreeBSD Hacker
(will work for bandwidth)



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