WADL representation/@element in xmlns=""

I am reporting a confusion I'm suffering about a WADL
representation/@element which refers to an element not in a namespace,
or in xmlns="" if you prefer to treat it that way.  I've found what I
believe is ambiguity in the spec, and an error in the
wadl_description.xsl stylesheet.

1. The Issue

My colleague Mariusz Jurgielewicz has shown me a WADL file containing 
<application xmlns="http://research.sun.com/wadl/2006/10">
  ...
  <representation mediatype="application/xml" element="foo" />

He noted that wadl_description.xsl was unable to find the Schema for the
representation.

I changed the WADL as follows:
<w:application xmlns="" xmlns:w="http://research.sun.com/wadl/2006/10">
  ...
  <wadl:representation mediatype="application/xml" element="foo" />
since it appears that wadl_description.xsl interprets the namespace of
unqualified attribute values of representation/@element as being in the
default namespace of the context.

However, it still doesn't work.

2. What the spec says

Not seeing much discussion on this list about namespaces or xmlns, I
consulted the WADL paper to see how to express no-namespace @element
values.

The wadl20090202 WADL paper says that representation/element is defined
as follows:
  For XML-based representations, specifies the qualified name of the
root 
  element as described within the grammars section - see section 2.3.

It seems like a good idea to be more precise here.  

Since XML doesn't define namespace rules for processing attribute value
content, so that's up to the application.  CURIEs are one approach, but
since this specification is about XML elements themselves, it's not a
good match.  XML Schema is more specific about it.  
The exact XML Schema approach won't work in WADL, because WADL isn't
about exactly one namespace, but I think it points again in the
direction that more precision about unqualified attribute values is
required, either in prose, or in additional markup for the WADL document
itself.  

A cautionary tale: XForms wasn't specific about the namespace of its
xf:bind/@type attribute, and some implementers chose it to default to
the XML Schema, while others chose it to be the host document.  Finally
the WG decided to fix the problems, by making the XForms namespace by
default, and to preserve interoperability with those who had chosen XSD
as the default by including copies of the XSD types in that namespace.

3. What wadl_description.xsl does
As for wadl_description.xsl, I believe that if it is to be able to
render WADL representations with elements in xmlns="", the stylesheet
needs some adjustments. 

I found that in wadl_documentation.xsl,
template/@match="wadl:representation|wadl:fault" calls
template/@name="get-element", which its qname argument to be qualified,
and cannot process unqualified element names.

        <xsl:variable name="localname" select="substring-after($qname,
':')"/>

Certainly this could be changed to
        <xsl:variable name="localname">
          <xsl:choose>
            <xsl:when test="substring-after($qname,
':')=''"><xsl:value-of select="$qname" /></xsl:when>
            <xsl:otherwise><xsl:value-of select="substring-after($qname,
':')" /></xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
 
But I suspect a more comprehensive fix is in order.

Leigh.

Received on Friday, 27 February 2009 20:48:47 UTC