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

Newbie: config file import, and http-request

From: David Priest <david@davidpriest.ca>
Date: Mon, 20 Sep 2010 15:05:40 -0700
Message-Id: <96CDAFB0-862B-4DD6-857E-565D9CBE1C27@davidpriest.ca>
To: xproc-dev@w3.org
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.

As near as I can figure, it should look like this (auth.xml):
<?xml version="1.0"?>
<c:param-set xmlns:c="http://www.w3.org/ns/xproc-step">
 <c:param name="uri" value="https://[uri]"/>
 <c:param name="username" value="[name]"/>
 <c:param name="password" value="[pw]"/>
</c:param-set>

The early scratchings for the http-request as follows (fetch.xpl):

<?xml version="1.0"?>
<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:output port="result"/>
 <p:parameters name="parameters">
   <p:input port="parameters">
     <p:document href="auth.xml"/>
   </p:input>
 </p:parameters>
 <p:variable name="query" select="'version.xml'"/>
 <p:variable name="uri" select="//c:param[@uri]/@value"><p:pipe port="parameters" step="pipeline"/></p:variable>
 <p:variable name="username" select="//c:param[@username]/@value"><p:pipe port="parameters" step="pipeline"/></p:variable>
 <p:variable name="password" select="//c:param[@password]/@value"><p:pipe port="parameters" step="pipeline"/></p:variable>
 <p:http-request>
   <p:input port="source">
     <p:inline>
       <c:request href="$uri$query" method="Get" detailed="true" username="$username" password="$password" auth-method="Basic"/>
     </p:inline>
   </p:input>
 </p:http-request>
</p:declare-step>

But of course that doesn't work at all.  Two things immediately spring to mind:

1. Surely there's a better way than the ugly variable assignments.

2. Much to my surprise, variable substitution doesn't work. One doesn't use $variablename as in XSLT.  But I can't see that using concat() would work.  Do I end up using a bunch of ugly with-params?

What I want at this point is exceedingly simple: to get the URI, username, and pw from a file, and return the results of querying that uri.  If I'm on the right track, great; if not, can someone point me the right direction?

Thanks in advance!
	david
Received on Tuesday, 21 September 2010 09:25:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 21 September 2010 09:25:05 GMT