Re: Composability

Norman Walsh wrote:
> / Jeni Tennison <jeni@jenitennison.com> was heard to say:
> | OK, so you think that's easy because you can detect that the option
> | has been set from a node in a document so you just pick up the
> | in-scope namespaces from that node. Now try this one:
> |
> |   <p:matching-documents>
> |     <p:option name="test"
> |       select="concat('/xhtml:html/xhtml:head/rdf:RDF[',
> |                      /my:config/my:filter/@test, ']')">
> |       <p:pipe step="top" source="config" />
> |     </p:option>
> |   </p:matching-documents>
> |
> | The namespace set needs to contain the in-scope namespaces from the
> | config document *and* some namespaces from the pipeline environment
> | (if those namespaces are even declared).
> 
> I'm sorry, why isn't it the responsibility of the pipeline author
> to provide in-scope bindings for xhtml: and my: on this option?
> 
>    <p:matching-documents xmlns:xhtml="...">
>      <p:option name="test" xmlns:my="..."
>        select="concat('/xhtml:html/xhtml:head/rdf:RDF[',
>                       /my:config/my:filter/@test, ']')">
>        <p:pipe step="top" source="config" />
>      </p:option>
>    </p:matching-documents>
> 
> That's what my implementation would expect.

It is, absolutely, the responsibility of the pipeline author to provide 
bindings for 'xhtml', 'rdf' and 'my'. But in this case the XPath that's 
passed as the value of the 'test' option is:

   /xhtml:html/xhtml:head/rdf:RDF[contact:person/contact:name = 'Jones']

So in fact the <p:matching-documents> step needs to be provided with 
namespace bindings for 'xhtml', 'rdf' and 'contact'. The first two can 
come from the pipeline environment, but the last has to come from the 
config document.

> I grant that I don't have a solution for this situation:
> 
>   <p:option name="someexpr" select="/config/@find">
>     <p:document href="/path/to/config.xml"/>
>   </p:option>
> 
>   <p:matching-documents>
>     <p:option name="test" select="$someexpr"/>
>   </p:matching-documents>
> 
> where the bindings in config.xml are unconstrained.

Quite.

> But I'm also not sure that the world will end if we don't solve that
> one in V1.

I'm pretty sure the world won't end no matter what we do in XProc. I'm 
also pretty sure that once people start writing pipelines "in anger", a 
lot of them are going to bang up against this brick wall.

We have lots of built-in steps that accept XPath expressions as options, 
because it's so darned useful. It seems insane not to support users 
writing their own pipelines that similarly take XPath expression 
options, and not to support users writing wrappers around those built-in 
steps.

Cheers,

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

Received on Thursday, 7 June 2007 21:09:40 UTC