Re: Namespace bindings

Alex Milowski wrote:
> On 8/9/07, Jeni Tennison <jeni@jenitennison.com> wrote:
>> The author of this pipeline can't just make the namespaces work. If the
>> pipeline was called with:
>>
>> <x:mydelete>
>>    <p:option name="delete" value="h:div"
>>      xmlns:h="http://www.w3.org/1999/xhtml" />
>> </x:mydelete>
>>
>> then the pipeline would fail to do what it was supposed to do.
>> Fortunately it would give an error because of the unbound prefix, so I
>> guess this isn't as dreadful as it could be, but it's still impossible
>> to work around, and it makes pipelines that take options that are XPaths
>> or QNames unviable.
> 
> The core of the idea is that every option value has a set of in-scope namespaces
> associated with it.  By default, the in-scope namespaces are those of the
> p:option element where the value was set.

Sure.

> For the above example:
> 
> <x:mydelete>
> <p:option name="delete" value="h:div" xmlns:h="http://www.w3.org/1999/xhtml"/>
> </x:mydelete>
> 
> that's going to work fine because the 'h' prefix is exactly what the
> author thinks
> it should be.

Err, no. Because the x:mydelete pipeline looks like:

<p:pipeline xmlns:p="..." xmlns:x="..."
             type="x:mydelete">
   <p:option name="delete" required="yes" />

   <p:delete>
     <p:input port="source">
       <p:inline>
         <html xmlns="http://www.w3.org/1999/xhtml">
         <head>...</head>
         <body>
           <h1>Delete My Divs</h1>
           <div>
             ...
           </div>
         </body>
       </p:inline>
     </p:input>

     <p:option name="match" select="$delete"
               xmlns:html="http://www.w3.org/1999/xhtml"/>
   </p:delete>
</p:pipeline>

The $delete option in x:mydelete gets set to "h:div" including the 
namespace binding {"h": "http://www.w3.org/1999/xhtml"}, fine. But when 
the $match option in p:delete gets set, it's set to "h:div" with the 
namespace binding {"html": "http://www.w3.org/1999/xhtml"}. There's no 
binding for the "h" prefix, so the step fails.

I don't see how your proposal handles this example (option value bound 
to option value), and I think think is going to be the most common case.

Cheers,

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 15 August 2007 12:42:12 UTC