Sinking(?) unwanted ports

I think that's what I want to do, but I can't figure out how to do it.  Given the scripts below, fetch.xpl craps out because the auth.xml file is part of the process stream, and isn't legitimate XProc.

Once I've got the auth information into variables, how do I get rid of the imported config document?  I've tried placing <p:delete match="//config"/> in a few places, <p:sink> in a few, etcetera.  None of it's working.

Come to think of it, if there are *any* improvements to this, I'd love to hear them!

(This needs to be done using an auth file, because I have no control over the code that calls XProc.  I can't trust it to supply name/pw/uri info; it's much easier to have someone edit the auth file once, than to create working code.)

calabash fetch.xpl query="version.xml"

<?xml version="1.0"?>
<config name="server">

<?xml version="1.0"?>
- log into server
- issue query
- return document -->
<p:declare-step xmlns:c="" xmlns:p="" name="fetch" version="1.0">
 <p:output port="result"/>
 <p:input port="parameters" kind="parameter"/>
 <p:option name="query" required="true"/>
 <!-- load login details  -->
 <p:load href="auth.xml"/>
 <!-- create a request template -->
 <p:group name="request">
   <p:variable name="uri" select="//uri"/>
   <p:variable name="username" select="//username"/>
   <p:variable name="password" select="//password"/>
   <p:wrap wrapper="c:request" match="/"/>
   <p:add-attribute match="c:request" attribute-name="href">
     <p:with-option name="attribute-value" select="concat($uri, $query)"/>
   <p:add-attribute match="c:request" attribute-name="username">
     <p:with-option name="attribute-value" select="$username"/>
   <p:add-attribute match="c:request" attribute-name="password">
     <p:with-option name="attribute-value" select="$password"/>
 <p:set-attributes match="/c:request">
   <p:input port="attributes">
       <c:request method="put" auth-method="Basic" send-authorization="true"/>
 <!-- send it via http-request -->

David Priest

Received on Wednesday, 22 September 2010 17:05:21 UTC