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

p:http-request to get file: URI

From: Romain Deltour <rdeltour@gmail.com>
Date: Thu, 7 Oct 2010 11:31:43 +0200
Message-Id: <E6E01ABC-CD6D-40A2-87AB-77F974B570C1@gmail.com>
To: XProc Dev <xproc-dev@w3.org>
Hi all,

Just for the record in case it can help others, here's how to load a  
local XML file from a GET HTTP request on a file: URI:

First I tried with the following Pipeline:

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

   <p:output port="result" sequence="true"/>

   <p:option name="href" select="'file:///Users/Romain/Documents/file.xml' 
   <p:option name="output" select="'output'"/>

   <p:add-attribute match="/c:request" attribute-name="href">
     <p:input port="source">
         <c:request method="get"  detailed="false"/>
     <p:with-option name="attribute-value" select="$href"/>

   <p:http-request media-type="application/xml"/>

<!--  <p:unescape-markup encoding="base64" charset="utf8"/>-->


However I was returned a c:body encoded in base64.

Using   <p:unescape-markup encoding="base64" charset="utf8"/> didn't  
work since it choked on the xml prolog within the content of the c:body.

After a little search in the XProc spec, I found that the trick is to  
use the override-content-type="application/xml" attribute on the  
c:request, to inform the http-request step that I'm getting an XML  

It may be simpler if Calabash would automatically detect XML documents  
and not encode them in base64, but I'm not sure if it can be easily  


PS: it's also possible to use the simpler p:load step, but in this  
specific case I needed to use the p:http-request.
Received on Thursday, 7 October 2010 09:32:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:07 UTC