RE: Saxonica Comments on XProc last-call draft, sections 1 and 2

> Yes, I was personally quite surprised when consensus went 
> that way, but it did. I don't think it's really a very 
> significant limitation because XProc steps give you other 
> ways of tackling the problem. The first that occurs to me is:
> 
>   <p:wrap-sequence>
>     <p:input port="source">
>        <p:pipe ... gets the first of two documents ... /> 
>        <p:pipe ... gets the second of two documents ... /> 
>     </p:input>
>     <p:option name="wrapper" value="wrapper"/>
>   </p:wrap-sequence>
> 
> Send the output of that step on to your transformation and 
> grab the two documents from inside the "wrapper".

But this (a) means rewriting the stylesheet (perhaps quite extensively - for
example it means that keys change their scope), and (b) almost certainly
cannot be implemented as efficiently, especially if one of the documents
contains lookup values that form an input to many transformations.
> 
> I'm sure that there are some things that could be done more 
> conveniently with structured parameter and option values, but 
> I think you'll need some pretty compelling use cases to 
> persuade the WG to undertake that large a change.

I think the use cases are very compelling.

Looking at how to make the change, I have to say I find the parameter
mechanism extraordinarily complicated for what it achieves, and it's not
obvious to me as a newcomer how to bend it. I'm also trying to work out how
you would use the p:parameter/@select attribute to compute a parameter (even
a string parameter) by looking inside a document produced by a previous
step, and I confess I don't see it. There seems to be a mechanism
p:xpath-context that allows this for the expression in a p:when/@test, but
the same mechanism doesn't seem to be available for p:parameter/@select. Why
the difference? If this mechanism were added, then I think you could simply
say that the value of the parameter is the result of the select expression,
without conversion unless the step itself chooses to perform a conversion.
You could then pass a document using

<p:parameter name="lookup" select="doc('lookup.xml')"/>

or

<p:parameter name="lookup" select=".">
  <p:xpath-context>
    <p:inline>
      <data/>
    </
  </
</

or

<p:parameter name="lookup" select=".">
  <p:xpath-context>
    <p:pipe step="a" port="b"/>
  </
</

(and perhaps this pattern is sufficiently common that a syntactic short-cut
is in order...)
 

Michael Kay
http://www.saxonica.com/

Received on Thursday, 27 September 2007 08:37:45 UTC