W3C home > Mailing lists > Public > xproc-dev@w3.org > January 2012

RE: why not in p:exec ... ""If cwd is not specified, the cwd is the same as the xproc file one is running."?

From: David Lee <dlee@calldei.com>
Date: Mon, 16 Jan 2012 09:45:40 -0500
To: "'Alex Muir'" <alex.g.muir@gmail.com>, "'XProc Dev'" <xproc-dev@w3.org>
Message-ID: <007501ccd45d$84eddd50$8ec997f0$@calldei.com>
Not speaking for the WG ... but  it won't keep me from speaking :)

 

1) The XProc "file" may not be a file, it could be 

A) In a database (such as EMC  ...)

B) Prepared dynamically

D) Directly fetched/executed off the internet (http:// ... )  

 

2) Not all OS's *HAVE* the notion of a CWD.   For example Windows Mobile has
no concept of a CWD.

 

 

 

 

----------------------------------------

David A. Lee

dlee@calldei.com

http://www.xmlsh.org

 

From: Alex Muir [mailto:alex.g.muir@gmail.com] 
Sent: Monday, January 16, 2012 9:36 AM
To: XProc Dev
Subject: why not in p:exec ... ""If cwd is not specified, the cwd is the
same as the xproc file one is running."?

 

Hi,

I'm reading that for p:exec "If cwd is not specified, the current working
directory is implementation-defined."

I'm just wondering why one wouldn't want to have implementations do and the
spec read that ""If cwd is not specified, the current working directory is
the same as the xproc file."

I found that the following did not work until I added a cwd and specified it
be the same dir as the xproc file I'm running

   <p:exec command="java"
cwd="/home/alex/UTSWEBClientWork/hg/automation/xproc/"
name="validate-with-rng"
        result-is-xml="false" wrap-result-lines="true">
        <p:with-option name="args" select="concat('-jar ../jing/jing.jar
-c', ' ',
            $relaxNGSchema , ' ', $xmlFileInput)">
            <p:empty/>
        </p:with-option>
    </p:exec>  


Wouldn't you want your cwd to always be the xproc file unless otherwise
specified? Why why not?


So anyway then had to get the directory of the current xproc file I'm
running dynamically

<p:directory-list name="tiger">
        <p:with-option name="path" select="'.'"/>
    </p:directory-list>
    <p:group>
        <p:variable name="cwd"
select="/c:directory/@*[namespace-uri()='http://www.w3.org/XML/1998/namespac
e' and local-name()='base']"/>
        
        <p:exec command="java"    name="validate-with-rng"
            result-is-xml="false" wrap-result-lines="true">
            <p:with-option name="args" select="concat('-jar ../jing/jing.jar
-c', ' ',
                $relaxNGSchema , ' ', $xmlFileInput)">
                <p:empty/>
            </p:with-option>
            <p:with-option name="cwd"
select="replace($cwd,'file:','')"></p:with-option>
        </p:exec>  
        
    </p:group>

Thanks
-- 

Alex Muir
Instructor | Program Organizer - University Technology Student Work
Experience Building
University of the Gambia 
http://sites.utg.edu.gm/alex/
<https://sites.google.com/a/utg.edu.gm/utsweb/> 

Low budget software development benefiting development in the Gambia, West
Africa
Experience of a lifetime, come to Gambia and Join UTSWEB -
http://sites.utg.edu.gm/utsweb/
<https://sites.google.com/a/utg.edu.gm/utsweb/> 
Received on Monday, 16 January 2012 14:46:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 16 January 2012 14:46:09 GMT