W3C home > Mailing lists > Public > xproc-dev@w3.org > September 2010

RE: Sinking(?) unwanted ports

From: <vojtech.toman@emc.com>
Date: Fri, 24 Sep 2010 09:52:41 -0400
Message-ID: <997C307BEB90984EBE935699389EC41C024E0FC8@CORPUSMX70C.corp.emc.com>
To: <xproc-dev@w3.org>
If you look at your pipeline more closely, you will see that you are
basically doing the following:

<p:load href="auth.xml"/>
 <!-- create a request template -->
<p:wrap wrapper="c:request" match="/"/>

In other words, you are wrapping the auth.xml document in a c:request
wrapper. This results in a c:request document that will be rejected by
p:http-request, because c:request can only contain c:header,
c:multipart, or c:body - but not "config", as is your case.

Of course, you should be able to delete "config" from the c:request
after you do p:wrap, but that would be just too much wasted work. Simply
don't use p:wrap at all and do the following:

<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:add-attribute match="c:request" attribute-name="href">
    <p:with-option name="attribute-value" select="concat($uri,
$query)"/>
    <p:input port="source">
      <p:inline><c:request></p:inline>
    </p:input>
  </p:add-attribute>
  <p:add-attribute match="c:request" attribute-name="username">
     <p:with-option name="attribute-value" select="$username"/>
  </p:add-attribute>
  <p:add-attribute match="c:request" attribute-name="password">
     <p:with-option name="attribute-value" select="$password"/>
  </p:add-attribute>
</p:group>
<p:http-request/>

You don't have to care about "getting rid" of the auth.xml document in
your pipeline. You don't have to explicitly p:sink documents that you no
longer want to use (the only exception is that you have to p:sink any
primary output ports that would otherwise remain unconnected). Clever
XProc implementations should be able to figure out when documents
flowing through the pipeline are not needed anymore, and release the
resources. So for instance, in the example above, the result of p:load
is not used after the last p:variable element, and the XProc
implementation can therefore release the document from memory at that
point. Note, however, that such optimizations are completely
implementation-dependent features, and the XProc specification does not
say anything about it.

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech
Received on Friday, 24 September 2010 13:54:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 24 September 2010 13:54:13 GMT