cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott_B...@lotus.com
Subject Re: R:R:pathargs problem
Date Fri, 03 Mar 2000 23:46:58 GMT

> 3) is legal, because it contains an attribute (whatever) that has a
> non-null namespace URI ("whatever:whatever" is the full name)

This is dead wrong.  In <xsl:stylesheet xsl:version="1.0" whatever=""
xmlns:xsl="xslt"
xmlns="whatever"/>  the "whatever" attribute's namespace is null.   That's
the way namespaces in xml work: the default namespace does *not* apply to
non-prefixed attributes.  Non-prefixed attributes *always* have a null
namespace.  Pier just went through this with Tim a week ago.  Here's the
note:

======================
At 09:51 PM 2/19/00 -0800, Pierpaolo Fumagalli wrote:
><document xmlns="http://www.betaversion.org/document"
>          xmlns:pier="http://www.betaversion.org/~pier/nsdecl">
>  <pier:testelement value="somevalue"/>
></document>
>
>I wanted to know what namespace URI the "value" attribute has...
>- is it the empty string ""?
>- is it the "pier" namespace "http://www.betaversion.org/~pier/nsdecl"?
>- is it the default namespace "http://www.betaversion.org/document"?

The attribute "value=" is not in any namespace.  An API could choose to
signal this with either a null value or an empty string, (the latter works
since the empty string can never be a legal namespace name), or by other
methods including exceptions and return code with side effects depending
on your programming language and religion.   I prefer the empty string
because in Java you can always say

 if (ns.equals(whateverNamespaceICareAbout))

instead of

 if ((ns != null) && ns.equals(whateverNamespaceICareAbout))

 -Tim
======================

With <xsl:stylesheet xsl:version="1.0" foo:whatever="" xmlns:xsl="xslt"
xmlns:foo="whatever"/> and <xsl:stylesheet version="1.0" foo:whatever=""
xmlns:xsl="xslt"
xmlns:foo="whatever"/>, the version attributes expand to two different
qualified names.  XSLT would have to check both qualified names, which
would be a compile-time performance hit.

> You guys should _NOT_ think about namespace prefixes but about real
> namespaces: their expanded values. Only in that case the things clear
> out.

We do.  I believe I know namespaces quite well.

> Note, however, that something like this is LEGAL
>
> <xsl:stylesheet xsl:version="1.0" whatever="" xmlns="whatever"
> xmlns:xsl="xslt"/>

This is not legal, as I said above: I believe both attributes are illegal.

> while something like this is NOT
>
> <xsl:stylesheet version="1.0" whatever="" xmlns="whatever"
> xmlns:xsl="xslt"/>

You're right, that's not legal either, but in this case only the whatever
attribute is illegal.

> <xsl:stylesheet xsl:version="1.0" version="1.0" whatever=""
>xmlns="whatever" xmlns:xsl="xslt"/>
>
>implies that both "whatever" and "xslt" namespace have the version "1.0"
>and it's perfectly legal.

I believe the version attribute would be implied being owned by the
xsl:stylesheet element, while the xsl:version attribute would be implied to
be owned by the xslt namespace as a whole, or something like that.  The
point is, the xmlns="whatever" has absolutely nothing to do with version
="1.0".

Does this change your mind at all?  In someways it's kind of arbitrary that
the XSLT spec may (or may not for all I know) say that xsl:version is
illegal.  We're having a XSL WG F2F here at Lotus next week, and I'll bring
this up for discussion.  (I'm sure James Clark could give an authorative
answer to this, but he's either not reading email, or just is just too busy
these days).  I'm just trying to do the right thing from the standpoint of
interoperability of stylesheets...

-scott




                                                                                         
                    
                    Stefano                                                              
                    
                    Mazzocchi            To:     cocoon-dev@xml.apache.org               
                    
                    <stefano@apac        cc:     James Clark <jjc@jclark.com>, Kay
Michael                    
                    he.org>              <Michael.Kay@icl.com>, James Tauber <JTauber@bowstreet.com>,
Tim     
                                         Bray <tbray@textuality.com>, Steve Muench <SMUENCH@us.oracle.com>,
  
                    03/03/00             sca@us.ibm.com, (bcc: Scott Boag/CAM/Lotus)     
                    
                    01:27 PM             Subject:     Re: R:R:pathargs problem           
                    
                    Please                                                               
                    
                    respond to                                                           
                    
                    cocoon-dev                                                           
                    
                                                                                         
                    
                                                                                         
                    




Scott_Boag@lotus.com wrote:
>
> We've come to the conclusion that Xalan is doing 100% the right thing by
> throwing an error for xsl:version on an xsl:stylesheet element.
>
> The recommendation says: "An element from the XSLT namespace may have any
> attribute not from the XSLT namespace, provided that the expanded-name of
> the attribute has a non-null namespace URI."  Note the "not from the XSLT
> namespace".

I believe you are wrong.

Quoting the specification above:

"An element from the XSLT namespace _may_ have any attribute _NOT_ from
the XSLT namespace, provided that the expanded-name of the attribute has
_non-null_ namespace URI."

A few cases (excuse the stupid namespace declaration):

1) <foo:stylesheet version="1.0" xmlns:foo="xslt"/>
2) <stylesheet version="1.0" foo:whatever="" xmlns="xslt"
xmlns:foo="whatever"/>
3) <xsl:stylesheet xsl:version="1.0" whatever="" xmlns:xsl="xslt"
xmlns="whatever"/>
4) <xsl:stylesheet xsl:version="1.0" foo:whatever="" xmlns:xsl="xslt"
xmlns:foo="whatever"/>

1) is legal, we all agree on that.
2) is legal, because it contains an attribute which expanded-name has a
non-null namespace URI
3) is legal, because it contains an attribute (whatever) that has a
non-null namespace URI ("whatever:whatever" is the full name)
4) is legal, because the above quote doesn't say anything about this. Of
course, this is the normal namespace behavior. It talks about attributes
from "other" namespaces. It is implied that the attributes of the
current namespaces _MUST_ be considered valid.

The above quote is only works for something like this

5) <xsl:stylesheet version="1.0" whatever="" xmlns:xsl="xslt"/>

which is ILLEGAL!!! because whatever expands to a NULL namespace and
it's not covered XSLT DTD.

Note, however, that something like this is LEGAL

<xsl:stylesheet xsl:version="1.0" whatever="" xmlns="whatever"
xmlns:xsl="xslt"/>

while something like this is NOT

<xsl:stylesheet version="1.0" whatever="" xmlns="whatever"
xmlns:xsl="xslt"/>

because version is part of the "whatever" namespace and you must be
_FORCED_ to apply the "xsl" prefix up front.

Something like this

<xsl:stylesheet xsl:version="1.0" version="1.0" whatever=""
xmlns="whatever" xmlns:xsl="xslt"/>

implies that both "whatever" and "xslt" namespace have the version "1.0"
and it's perfectly legal.

> I could be misinterpreting this passage.  If someone disagrees with this
> interpretation, please let me know.  But for now, I think Xalan is doing
> the right thing, and will leave things as they are.  (Note that
foo:version
> will not cause an error to be thrown, providing foo binds to a non XSLT
> namespace).

You guys should _NOT_ think about namespace prefixes but about real
namespaces: their expanded values. Only in that case the things clear
out.

--
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!
------------------------- http://ApacheCon.Com ---------------------







Mime
View raw message