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

Hi Alex,



I may have a simpler way of getting the current directory. I use the
following quite a lot in my xproc-ebook-conv project:



               <p:variable name="lib-base-uri"
select="base-uri(.)"><p:inline><x/></p:inline></p:variable>



An expression like: resolve-uri('./', $lib-base-uri) gives you the
directory with an ending slash.



But David makes sensible remarks. It could well be that even this approach
does not return a useful uri..



Cheers,

Geert



*Van:* Alex Muir [mailto:alex.g.muir@gmail.com]
*Verzonden:* maandag 16 januari 2012 15:36
*Aan:* XProc Dev
*Onderwerp:* 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/namespace' 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 18:33:27 UTC