- From: Romain Deltour <rdeltour@gmail.com>
- Date: Mon, 20 Dec 2010 15:28:26 +0100
- To: Florent Georges <fgeorges@fgeorges.org>
- Cc: XProc Dev <xproc-dev@w3.org>
Mmm... interestingly it seems that a workaround is to pipe the store
result with a p:identity just before the p:group:
<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="root/text()" name="uuid">
<p:input port="source">
<p:inline>
<root>@@</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>
<p:identity name="identity">
<p:input port="source">
<p:pipe port="result" step="store"/>
</p:input>
</p:identity>
<!-- 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="identity" 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>
It definitely looks like a bug in Calabash, probably related to the
p:store's output port not being primary...
Romain.
Le 20 déc. 10 à 14:34, Florent Georges a écrit :
> 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 14:29:02 UTC