W3C home > Mailing lists > Public > xproc-dev@w3.org > February 2013

Reading ports from XPath functions

From: Norman Walsh <ndw@nwalsh.com>
Date: Sat, 09 Feb 2013 15:20:36 +0100
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <m2k3qhr2kr.fsf@nwalsh.com>
Hello world,

At XML Prague, both yesterday in the XProcathon and today in Romain
Deltour's excellent presentation[1], the suggestion was made that it
would be nice to be able to read ports from XPath expressions. I
imagine we're talking about something like this:

  <px:some-step name="somename">...</px:some-step>

    <p:with-param name="someParam" select="p:read-port('some-step', 'result')/x/y"/>

I can certainly see the appeal, but it's worth pointing out that this
complicates the data flow analysis that an XProc processor must

Today, the processor can look at the port connections and build the
entire flow graph. With an extension function that can read from
ports, it would be necessary to parse all the XPath expressions in
order to find the connections. That's not too burdensome, but it is
certainly some burden.

And, of course, as soon as you can do p:read-port('some-step',
'result'), someone is going to ask for p:read-port($step, $port) and
that's a whole new can of worms to consider.

(I believe we would *have* to impose the restriction that $step and
$port could be resolved statically, but that wouldn't make users

If you only want to read from *one* port, I think you can always get
the results you want:

    <p:with-param name="someParam" select="/x/y">
      <p:pipe step="somename" port="result"/>

But suppose you want to work with the output of two ports:

    <p:with-param name="booleanParam"
                  select="p:read-port('a','b')/root > p:read-port('c','d')"/>

Then, you've got to work harder:

  <p:variable name="aroot" select="/root">
    <p:pipe step="a" port="b"/>

  <p:variable name="croot" select="/root">
    <p:pipe step="c" port="d"/>

    <p:with-param name="booleanParam" select="$aroot > $croot"/>

(Which may involve introducing a new group, but that's a different problem.)

In short: adding p:read-port wouldn't introduce any new functionality,
it would be a convenience. It would have to have some limitations that
users probably wouldn't expect. On the whole, I can't decide if the
(perhaps significant) additional implementation complexity is worth it[2].

[1] http://www.xmlprague.cz/sessions/#xprocebook
[2] "Implementation isn't the user's problem, that's why we pay programmers."

                                        Be seeing you,

P.S. Lots of XProc love at XML Prague. Yay!

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 512 761 6676

Received on Saturday, 9 February 2013 14:21:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:10 UTC