W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > May 2007

RE: More checked into CVS

From: Jo Rabin <jrabin@mtld.mobi>
Date: Tue, 15 May 2007 11:33:17 +0100
Message-ID: <C8FFD98530207F40BD8D2CAD608B50B42B405B@mtldsvr01.DotMobi.local>
To: Roland Gülle <roland@7val.com>
Cc: <public-mobileok-checker@w3.org>

> To use the namespaces in my XPath, I use (not regarding any namespace
> policy):
> <xsl:stylesheet... xmlns:moki="http://moki.mobi/2007/
> v0.1" ...xmlns="http://moki.mobi/2007/v0.1">
> to use XPath like:
> /moki:moki//moki:docContent
> 

But if you say xmlns="http://moki.mobi/2007/v0.1" in you stylesheet, you don't need to use the prefix when selecting moki elements, providing there is a similar namespace declaration at the root of the moki doc, or am I missing the point?

(<moki xmlns="http://moki.mobi/2007/v0.1" ...)

> But is there an issue with the _real_ document namespaces?
> In this example, the document has an empty namespace:
> <docContent>
>    <html xmlns="">
>    ...
> What if the document uses different/other namespaces?
> 

Oops, it should say <html xmlns="http://www.w3.org/1999/xhtml"> I just noticed that the example moki doc from before has <html xmlns=""> which is wrong.

So providing the html is namespaced properly and the stylesheet says something like

<xsl:stylesheet... xmlns="http://moki.mobi/2007/v0.1" xmlns:html="http://www.w3.org/1999/xhtml">


then the XPath expression //primaryDoc//html:html should select the content of the primary document ...

... with regard to the following:
 
> Should we always use 'namespace-safe' XPath (//*[local-name() =
> 'html'])?
> Should namespaces be removed by the 'moki doc generator' inside the
> docContent?
> 
No, I don't think so, [though I often do this :-)], because in theory at least, your document might contain content with an html element from another namespace ... more important of course if you are looking at an element like head which is used in lots of namespaces.

Jo

> -----Original Message-----
> From: Roland Gülle [mailto:roland@7val.com]
> Sent: 15 May 2007 10:53
> To: Jo Rabin
> Cc: public-mobileok-checker@w3.org
> Subject: Re: More checked into CVS
> 
> >> <xsl:stylesheet version="1.0"
> >>                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >>
> >> 	xmlns:xmlns="http://moki.mobi/2007/v0.1">
> >
> > Shouldn't we actually be setting the default namespace by
> >
> > xmlns="http://moki.mobi/2007/v0.1" rather than by
> > xmlns:xmlns="http://moki.mobi/2007/v0.1"?
> OK, to generate this as output namespace works, but using this in my
> XPath will not work.
> 
> To use the namespaces in my XPath, I use (not regarding any namespace
> policy):
> <xsl:stylesheet... xmlns:moki="http://moki.mobi/2007/
> v0.1" ...xmlns="http://moki.mobi/2007/v0.1">
> to use XPath like:
> /moki:moki//moki:docContent
> 
> But is there an issue with the _real_ document namespaces?
> In this example, the document has an empty namespace:
> <docContent>
>    <html xmlns="">
>    ...
> What if the document uses different/other namespaces?
> 
> Should we always use 'namespace-safe' XPath (//*[local-name() =
> 'html'])?
> Should namespaces be removed by the 'moki doc generator' inside the
> docContent?
> 
>   roland
Received on Tuesday, 15 May 2007 10:33:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:03 GMT