RE: V.next: resource manager

> Suppose http://example.com/doc.xml contains:
> 
>   <doc>
>     <a/>
>     <b/>
>     <c/>
>   </doc>
> 
> And consider this pipeline fragment:
> 
>   <p:delete match="a">
>     <p:input port="source">
>       <p:document href="http://example.com/doc.xml"/>
>     </p:input>
>   </p:delete>
> 
>   <p:sink/>
> 
>   <p:xinclude>
>     <p:input port="source">
>       <p:inline>
>         <book>
>           <xi:include href="http://example.com/doc.xml"/>
>         </book>
>       </p:inline>
>     </p:input>
>   </p:xinclude>
> 
> Assume for the moment that the p:delete step runs to completion before
> the p:xinclude step starts.
> 
> Which document does the p:xinclude step produce?
> 
>   <book>
>   <doc>
>     <a/>
>     <b/>
>     <c/>
>   </doc>
>   </book>
> 
> or
> 
>   <book>
>   <doc>
>     <b/>
>     <c/>
>   </doc>
>   </book>
> 
> I think the latter is the more useful, if perhaps more surprising,
> result.

Since we say that steps are side-effect free, I think it produces the former. I agree with you that the latter result might be more useful in some cases (and be really confusing in other cases), but I think you can achieve the same with something like this:

<p:delete match="a">
  <p:input port="source">
    <p:document href="http://example.com/doc.xml"/>
  </p:input>
</p:delete>
 
<p:store ext:resource-manager="true">
  <p:with-option name="href" select="base-uri()"/>
</p:store>

<p:xinclude>
  <p:input port="source">
    <p:inline>
      <book>
        <!-- loads the document from the resource manager -->
        <xi:include href="http://example.com/doc.xml"/>
      </book>
    </p:inline>
  </p:input>
</p:xinclude>

It relies on extensions, but not difficult to do.

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

Received on Thursday, 5 January 2012 14:39:19 UTC