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

Re: Newbie: config file import, and http-request

From: Florent Georges <fgeorges@fgeorges.org>
Date: Tue, 21 Sep 2010 11:30:51 +0100
Message-ID: <AANLkTi=7JyBur90CYJ7D=iDbs0RK9PzMn3QN35k360QK@mail.gmail.com>
To: David Priest <david@davidpriest.ca>
Cc: xproc-dev@w3.org
On 20 September 2010 23:05, David Priest wrote:

  Hi,

> I'm beginning to experiment with replacing Ant with XProc.  One
> of my key items involves accessing an HTTPS server.  Of course,
> I don't want my credential details getting into the repository,
> so I would like to have a config file that provides username
> and password.

  You can use p:add-attribute:

<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                xmlns:p="http://www.w3.org/ns/xproc"
                name="mir.fetch"
                version="1.0">

   <p:input port="source">
      <p:inline>
         <c:request method="get" detailed="true" auth-method="basic"/>
      </p:inline>
   </p:input>
   <p:output port="result"/>

   <p:parameters name="params">
      <p:input port="parameters">
         <p:document href="dpriest.xml"/>
      </p:input>
   </p:parameters>

   <p:add-attribute match="/c:request" attribute-name="username">
      <p:input port="source">
         <p:pipe port="source" step="mir.fetch"/>
      </p:input>
      <p:with-option name="attribute-value" select="
          /c:param-set/c:param[@name eq 'username']/@value">
         <p:pipe port="result" step="params"/>
      </p:with-option>
   </p:add-attribute>

   <p:add-attribute match="/c:request" attribute-name="password">
      <p:with-option name="attribute-value" select="
          /c:param-set/c:param[@name eq 'password']/@value">
         <p:pipe port="result" step="params"/>
      </p:with-option>
   </p:add-attribute>

   <p:add-attribute match="/c:request" attribute-name="href">
      <p:with-option name="attribute-value" select="
          concat(/c:param-set/c:param[@name eq 'uri']/@value, 'version.xml')">
         <p:pipe port="result" step="params"/>
      </p:with-option>
   </p:add-attribute>

   <!-- commented out to see the c:request element instead -->
   <!--p:http-request/-->

</p:declare-step>

  I used to use options for that exact same purpose[1], but using
a file can be interesting in some cases.

  Regards,

-- 
Florent Georges
http://fgeorges.org/

[1]http://code.google.com/p/expath/source/browse/trunk/website/tools/upload.xproc
Received on Tuesday, 21 September 2010 10:31:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 21 September 2010 10:31:45 GMT