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

Re: Initializing a variable using an output port

From: Florent Georges <fgeorges@fgeorges.org>
Date: Mon, 20 Dec 2010 14:34:52 +0100
Message-ID: <AANLkTikd-BVfdgtEULr10aGOnx9HWC0QSqAVbH8hxg_e@mail.gmail.com>
To: Romain Deltour <rdeltour@gmail.com>
Cc: XProc Dev <xproc-dev@w3.org>
On 20 December 2010 13:44, Florent Georges wrote:

> I will try to make a proper standalone repro then.

  Interesting, I got a repro, and the problem only shows up when
I compute the file name (the href of p:store) using a UUID got
from p:uuid.  So with a working pipeline using:

    <p:store name="store" href="/tmp/xproc-store.xml">
       <p:input port="source">
          <p:inline>
             <doc/>
          </p:inline>
       </p:input>
    </p:store>

if I change that bit by:

   <p:uuid match="placeholder" name="uuid">
      <p:input port="source">
         <p:inline>
            <root>
               <placeholder/>
            </root>
         </p:inline>
      </p:input>
   </p:uuid>

   <p:store name="store">
      <p:input port="source">
         <p:inline>
            <doc/>
         </p:inline>
      </p:input>
      <p:with-option name="href" select="
          concat('/tmp/', normalize-space(.), '.xml')">
         <p:pipe step="uuid" port="result"/>
      </p:with-option>
   </p:store>

then it fails later on, when evaluating the p:variable.  Well, I
thought that was during evaluating p:variable, but because no
file is produced at all in that case, it seems that's a static
error.

  Here is a complete repro (the first one fails as described, the
second one works as expected):

    <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"/>
       <!-- get a UUID -->
       <p:uuid match="placeholder" name="uuid">
          <p:input port="source">
             <p:inline>
                <root>
                   <placeholder/>
                </root>
             </p:inline>
          </p:input>
       </p:uuid>
       <!-- store a doc, using the UUID in the file name -->
       <p:store name="store">
          <p:input port="source">
             <p:inline>
                <doc/>
             </p:inline>
          </p:input>
          <p:with-option name="href" select="
              concat('/tmp/', normalize-space(.), '.txt')">
             <p:pipe step="uuid" port="result"/>
          </p:with-option>
       </p:store>
       <!-- store the file name in a var, and create a nw doc -->
       <p:group>
          <p:variable name="file" select="/xs:string(c:result)">
             <p:pipe step="store" port="result"/>
          </p:variable>
          <p:add-attribute match="hello" attribute-name="a">
             <p:input port="source">
                <p:inline>
                   <hello/>
                </p:inline>
             </p:input>
             <p:with-option name="attribute-value" select="$file"/>
          </p:add-attribute>
       </p:group>
    </p:declare-step>

  The following repro works well:

    <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"/>
       <!-- store a doc -->
       <p:store name="store" href="/tmp/xproc-store.xml">
          <p:input port="source">
             <p:inline>
                <doc/>
             </p:inline>
          </p:input>
       </p:store>
       <!-- store the file name in a var, and create a nw doc -->
       <p:group>
          <p:variable name="file" select="/xs:string(c:result)">
             <p:pipe step="store" port="result"/>
          </p:variable>
          <p:add-attribute match="hello" attribute-name="a">
             <p:input port="source">
                <p:inline>
                   <hello/>
                </p:inline>
             </p:input>
             <p:with-option name="attribute-value" select="$file"/>
          </p:add-attribute>
       </p:group>
    </p:declare-step>

  So maybe I made a mistake, but more and more it looks like a
bug.  I wanted to test with Calumet, but I don't have it on this
machine and the EMC community site seems to be down.

  Regards,

-- 
Florent Georges
http://fgeorges.org/
Received on Monday, 20 December 2010 13:35:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 20 December 2010 13:35:46 GMT