Re: Getting the current working directory

Hi Patrick,

On Wed, 25 Oct 2017 13:27:25 +0200,
Patrick Gundlach wrote:
> 
> Hello all,
> 
> I try to use a simple pipeline which runs an XSLT stylesheet. Now I'd like to pass a parameter (it is a pointer to a file in the current working directory).
> 
> My pipeline so far is:
> 
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>     xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>     <p:xslt name="Transformation">
>         <p:input port="parameters">
>             <p:empty/>
>         </p:input>
>         <p:input port="source">
>             <p:document href="source.xml"/>
>         </p:input>
>         <p:input port="stylesheet">
>             <p:document href="transformation.xsl"/>
>         </p:input>
>     </p:xslt>
>     <p:store href="data.xml"/>
> </p:declare-step>
> 
> 
> I have found out how to pass a parameter to the stylesheet
> 
> 
> <p:xslt name="Transformation">
>     <p:with-param name="somefile" select="'somefile.xml'">
>         <p:empty/>
>     </p:with-param>
>     ....
> 
> 
> The transformation.xsl resides in a different directory than the
> current directory, but I'd like to tell the XSLT to use a file
> (somefile.xml) from the current directory. How is this possible?
>

AFAIK getting the current directory is not possible with vanilla XProc
1.0, but there is an XProc extension step pos:info that retrieves
information about the processor's environment:

http://exproc.org/proposed/steps/os.html

This is how I can do it in Calabash:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:pos="http://exproc.org/proposed/steps/os"
                version="1.0">
 
  <p:output port="result"/>
  <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
  <pos:info/>
  
</p:declare-step>

=>

<c:result xmlns:c="http://www.w3.org/ns/xproc-step" file-separator="\" path-separator=";" os-architecture="amd64" os-name="Windows 7" os-version="6.1" cwd="D:\H
ome\tmp" user-name="maus" user-home="C:\Users\maus"/>

HTH,
  -- David

> 
> Patrick
> 
> 
> BTW: is there any manual for xproc?

-- 
David Maus M.A.
Okerstraße 5 ~ 38300 Wolfenbüttel ~ GERMANY
http://dmaus.name
PGP Key 0x27023DFCE78FF66C

Received on Wednesday, 25 October 2017 12:21:27 UTC