- From: Norman Walsh <ndw@nwalsh.com>
- Date: Mon, 29 Sep 2008 16:21:12 -0400
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m263oezosn.fsf@nwalsh.com>
James Garriss <james@garriss.org> writes:
> A pipeline that contains this:
>
> <p:for-each name="step1">
> <p:iteration-source select="//Book"/>
> <p:store href="books.xml"/>
> </p:for-each>
>
> might overwrite the file "books.xml" many times.
Yep. If that's not what you meant...why'd you write it? :-)
> 1) Does the the XProc spec give guidance to XProc processors on how to
> handle overwrites? Should it?
I don't think so. We could decide that that was an error, as the XSLT
spec does wtih xsl:result-document, I suppose. If you'd prefer that
answer, I suggest you propose it on the comments list.
> 2) How would you prevent an overwrite? Is there a way to give a unique
> filename for each book when p:store writes it?
You could use the iteration-position:
<p:store name="store">
<p:with-option name="href"
select="concat('books-', p:iteration-position(), '.xml')"/>
</p:store>
or you could use some value from the context node (e.g., the @xml:id,
if each Book has one).
<p:store name="store">
<p:with-option name="href"
select="concat('books-', /*/@xml:id, '.xml')"/>
</p:store>
Or both. Or something else.
Alas, neither of these solutions runs in Calabash 0.6.3. I bungled the
namespace bindings in the former case and the context item in the
latter. But the former is now fixed and I'll see if I can fix the
latter as well, sometime this week.
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | I'm NOT in denial!
http://nwalsh.com/ |
Received on Monday, 29 September 2008 20:21:53 UTC