fatty- / daisy-pipeline

Automatically exported from code.google.com/p/daisy-pipeline
0 stars 0 forks source link

Providing string sequences to XProc scripts #311

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Options currently only accept basic string values. In some cases it would be 
useful to be able to accept multiple strings (for instance, HTML-to-EPUB3 could 
accept multiple HTML hrefs).

#### Suggestion #1: www-form-urlencoding ####

In the Web API, the values would be provided as items (just like it's currently 
done for ports):
<jobRequest>
    ...
    <option name="hrefs">
        <item value="my html file.html"/>
        <item value="my other html file.html"/>
    </option>
</jobRequest>

XProc only accepts strings, so the values will have to be encoded. If 
px:sequence="true", multiple items would be allowed and the items could be 
encoded using for instance the www-form-urlencoded algorithm, which can be read 
natively by XProc using p:www-form-urldecode. The output from 
p:www-form-urldecode would be something like:
<c:param-set>
    <c:param name="item" value="my html file.html"/>
    <c:param name="item" value="my other html file.html"/>
</c:param-set>

A disadvantage of using www-form-urlencoding is that it's more difficult to use 
the script from the CLI.

#### Suggestion #2: repurpose parameter ports ####

If we add a px:require-parameter-names="false" attribute to the parameter port 
in XProc (and expose it through the Web API), that would signal to the client 
that specifying the parameter names is not necessary; which in practice would 
make the parameter port accept string sequences instead of parameter sets. It 
is up to the client to choose a name for each parameter, but it need not be 
exposed to the end-user:
<c:param-set>
    <c:param name="item" value="my html file.html"/>
    <c:param name="item" value="my other html file.html"/>
</c:param-set>

What do you think?

Original issue reported on code.google.com by josteinaj@gmail.com on 6 May 2013 at 8:25

GoogleCodeExporter commented 9 years ago
In the f2f we agreed to just use separators which can be defined in the script 
via the px:separator element. 
https://code.google.com/p/daisy-pipeline/wiki/ScriptMetadataCleanup#px:separator

Here it's done:
https://github.com/daisy-consortium/pipeline-framework/tree/input_sequences

Original comment by capitan....@gmail.com on 27 Jun 2013 at 10:09

GoogleCodeExporter commented 9 years ago

Original comment by rdeltour@gmail.com on 2 Jul 2013 at 8:40