More on Store

Hello. I would like to comment on the Store step, currently in the WD.

A note on it asks
"Should this component allow sequences on its input?"
I say "Why not?". It would be useful to save bunch of XML documents at the
same point and I don't think it would be that much more hard to implement
such a feature. For actual URI resolution (selection of the filename to be
exact) use whatever mechanism is defined to be used when "href" is not
specified.

Speaking of it, I don't see any such naming convention. Is there one? If
not, I suggest that the name of the input ports with ".xml" as extension
should be used. Two new optional options, perhaps called "file-prefix" and
"file-suffix" could be used to tweak this naming convention, so that with
<p:store>
	<p:input port="a"/>
	<p:input port="b"/>
	<p:output port="result"/>
	<p:option name="file-prefix" value="MY"/>
	<p:option name="file-suffix" value=".svg"/>
	<p:option name="encoding" value="UTF-8"/>
</p:store>
the URI to which the documents would be saved will be
MYa.svg and MYb.svg respectively.
(Is that the correct syntax of providing a sequence of inputs?)
Without them, the URIs would be a.xml and b.xml respectively.

If "href" is used with a sequence of inputs, it's value should only be the
base URI from which on the files will be saved. Actually, such convention
could also be established for single inputs too. That is, if we have:
<p:store>
	<p:input port="a"/>
	<p:input port="b"/>
	<p:output port="result"/>
	<p:option name="href" value="subfolder/"/>
	<p:option name="file-prefix" value="MY"/>
	<p:option name="file-suffix" value=".svg"/>
	<p:option name="encoding" value="UTF-8"/>
</p:store>
The URIs will be "subfolder/MYa.svg" and "subfolder/MYb.svg" respectively.
And with
<p:store>
	<p:input port="a"/>
	<p:output port="result"/>
	<p:option name="href" value="subfolder/"/>
	<p:option name="file-prefix" value="MY"/>
	<p:option name="file-suffix" value=".svg"/>
	<p:option name="encoding" value="UTF-8"/>
</p:store>
The URI would be "subfolder/MYa.svg" only. Such unification should be done
so that the URI could be predictable in both sequence and single inputs.

Last, but not least, the output of this step will be kept to:
<c:result href = anyURI />
However, anyURI would be a white space separated list of URIs (like the
xsi:schemaLocation), each from the sequence in the order specified in the
step. So the above examples' outputs would look like
<c:result href="MYa.svg MYb.svg"/>, <c:result href="a.xml b.xml"/>,
<c:result href="subfolder/MYa.svg subfolder/MYb.svg"/> and <c:result
href="subfolder/MYa.svg"/> respectively.

I know it may seem to complicate implementation of XProc a bit, but looking
from an author's point of view, what's the alternative? Having multiple
instances of this step? Not only does this make the XProc file a lot more
verbose, but it could also be more inefficient (I don't know for sure, as I
haven't tried implementing it) as the step will have to be evaluated
multiple times, instead of being evaluated a single time following a single
pattern multiple times.

Btw, this is just a personal preference, but why not call the step "save"?
It just seems more natural, since it's closely related to its... companion -
"load" and besides, you're actually "saving" the document. Storing it is
only the consequence of the actual saving being done.

Thanks for reading.

Received on Saturday, 28 April 2007 23:37:16 UTC