Faking primary ports?

Dear xproc-dev,

I'm still new to XProc 3.0 (and not very experienced with 1.0), and I've
written an XProc file that runs several XSLT transformations, each with
different input XML, XSLT, and output. It isn't really a pipeline
conceptually because each transformation is independent of the others, so
if my use of XProc (instead of, say, a shell script) reflects a
misunderstanding on my part of the types of operations for which XProc is
appropriate, I would be grateful for the correction. I am using
Morgana 0.9.4.2-beta.

If, though, XProc is a reasonable way to approach the task, I have two
semi-related questions:

1. My XProc begins by declaring primary ports that I don't use, because
each <p:xslt> step specifies its own XML input, its own stylesheet, its own
parameters (where relevant), and after each transformation I save the
result with <p:store>. At the end of the entire XProc I suppress the
default output with <p:sink/>. Declaring primary ports that I don't use
(because I handle the input and output for each of the transformations
separately) smells non-idiomatic, but omitting those declarations raises
error XS0032 (Primary input port 'source' on step '!1.1' is not bound). Is
there a more idiomatic strategy? My current primary port declarations look
like:

<p:input port="source" sequence="true">
    <p:empty/>
</p:input>
<p:output port="result" sequence="true"/>

2. One of my XSLT transformations does not read regular input; it gets the
XML that it transforms from two documents specified in variables that it
declares internally. If I were writing stand-alone XSLT 3 I would declare
an initial template in the stylesheet with "xsl:initial-template" and use
the "-it" switch (for Saxon) on the command line. I can pass in dummy XML
input, ignore it, and get the output I want, but that, too, smells
non-idiomatic. Is there an idiomatic alternative? Of the half dozen
mutually independent XSLT transformations in my XProc, only one of them
gets its data entirely from variables; the others all use input supplied in
the normal way, e.g.:

<p:xslt>
  <p:with-input port="stylesheet">
    <p:document href="mappingsToHTML.xsl"/>
  </p:with-input>
  <p:with-input port="source">
      <p:document href="mappings.xml"/>
  </p:with-input>
</p:xslt>
<p:store href="mappings.html" name="mappingsHTML"/>

Best,

David

Received on Tuesday, 8 September 2020 23:38:01 UTC