Re: RDFa reliance on namespace declaration

Hi Ian,

> My language was sloppy. I meant it copied across only the namespace
> declarations used to name elements and attributes in the resulting
> document.

Ok...that's closer to what I would expect...but still not quite there
(see below).


> My result consisted of a copy of Ben's home page with the x:
> namespace prefix bound to the XHTML namespace. No other namespaces were
> declared in the result document.

I'm surprised that you are losing namespaces that aren't used. We use
XSLT in our company all the time to manipulate XForms documents, and
XForms uses XPath expressions within attributes; but although there
will often be cases where a namespace prefix is declared but appears
to not be used it is always copied through fine.

The same goes for XML Schema documents, WSDL files, even XSLT files
themselves--there are plenty of situations where a namespace that is
declared in some part of a document *appears* to not be used, but is
still passed through.

(Just so that I can be sure that we are definitely talking about the
same thing, by "appears to not be used", I mean that a namespace is
declared at some point in the document, and then some other mark-up
makes use of that namespace, but the 'use' is inside an attribute.
XSLT itself does this, of course.)

So in your example of using Ben's page, I would expect the namespaces
for CC, FOAF, and so on, to now be on the <head> and the <body>
elements, regardless of the fact that there are no elements or
attributes in the rest of the document that use these prefixes. The
reason I expect it, is because you have used the copy-of instruction,
which should copy everything through, including namespace nodes.

Since XSLT itself says it will copy the namespaces through, I can only
conclude that if you are not getting them something else must be going
wronig, especially since I've tested your stylesheet now with four or
five different XSLT processors and I always get the 'unused'
namespaces through. (That includes testing with Xsltproc, via oXygen.)

Perhaps you could tell me what software you are using, which versions,
and so on, and I can download them and try all of this outside of
oXygen. And if you have time, perhaps you can look at other XSLT
processors to see if you ever get the 'unused' namespaces through.

> > * why do you see it as a common need to write a stylesheet that very
> > consciously removes all namespace declarations from the root element?
>
> That's not it's intention. In fact, the stylesheet processor will copy
> across namespace declarations that are used by elements and attributes.
> But it can't possibly understand the notational convention used by RDFa
> so doesn't see those usages in attrbute content.

That's not how XSLT works--in general it should copy the namespaces
through regardless of whether they are used in an element or
attribute.


> As I said in my earlier email, stylesheets written in this way are not
> atypical in my experience.

But stylesheets that quite happily process XForms, XSLT, XML Schema,
WSDL, and a host of other languages that use QNames have been working
for years.

Regards,

Mark


-- 
Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/

Received on Friday, 16 June 2006 21:11:39 UTC