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

Re: Initializing a variable using an output port

From: Romain Deltour <rdeltour@gmail.com>
Date: Mon, 20 Dec 2010 10:24:13 +0100
Cc: XProc Dev <xproc-dev@w3.org>
Message-Id: <10BFA0D0-6513-432A-973B-D1CBEBE87D45@gmail.com>
To: Florent Georges <fgeorges@fgeorges.org>
I had a look with the following pipeline (standard XProc, so that it  
could be reproduced with other engines):

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

   <p:output port="result"/>

   <p:store name="first" href="store.xml">
     <p:input port="source">
       <p:inline><doc/></p:inline>
     </p:input>
   </p:store>
   <p:group>
     <p:variable name="var" select="/xs:string(c:result)">
       <p:pipe step="first" port="result"/>
     </p:variable>
     <p:add-attribute attribute-name="attr" match="/*">
       <p:with-option name="attribute-value" select="$var"/>
       <p:input port="source">
         <p:inline><doc/></p:inline>
       </p:input>
     </p:add-attribute>
   </p:group>

</p:declare-step>

I works as expected with Calabash 0.9.28, outputting:

<doc attr="file:/path/to/my/store.xml"/>


Could it be that the extended p:store (with the cx:decode) outputs an  
empty document ?

Romain.


Le 20 déc. 10 à 00:44, Florent Georges a écrit :

>  Hi,
>
>  I store a binary file, using p:store and a Calabash extension
> to be sure the Base 64 is decoded.  That part works perfect:
>
>    <p:store name="store" cx:decode="true" .../>
>
>  This file is a ZIP file.  I then use the EXProc extension step
> pxp:unzip to get an XML entry out of this ZIP file:
>
>    <p:store name="store" .../>
>    <pxp:unzip ...>
>       <p:with-option name="href" select="/xs:string(c:result)">
>          <p:pipe step="store" port="result"/>
>       </p:with-option>
>    </pxp:unzip>
>    ...
>
>  That works well.  The p:store returns a document that looks
> like <c:result>file:/...</c:result>, which is used when computing
> the href option.  But I need to use this file name several times,
> so I store it instead in a variable:
>
>    <p:store name="store" .../>
>    <p:group>
>       <p:variable name="file" select="/xs:string(c:result)">
>          <p:pipe step="store" port="result"/>
>       </p:variable>
>       <pxp:unzip ...>
>          <p:with-option name="href" select="$file">
>       </pxp:unzip>
>       ...
>    </p:group>
>
>  But then I receive the following dynamic error (from Calabash):
> "Expression refers to context when none is available:
> /xs:string(c:result)".  I thought both constructions above were
> equivalent.  What did I miss?
>
>  Regards,
>
> -- 
> Florent Georges
> http://fgeorges.org/
>
Received on Monday, 20 December 2010 09:24:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 20 December 2010 09:24:53 GMT