W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2020

Re: Creating and using variables ... again ...

From: David Birnbaum <djbpitt@gmail.com>
Date: Fri, 6 Nov 2020 12:49:41 -0500
Message-ID: <CAP4v81q80T7LAM+dfNi17HJ22diPky6=xQVYjkyGnU5fuLRBGA@mail.gmail.com>
To: Martin Honnen <martin.honnen@gmx.de>
Cc: XProc Dev <xproc-dev@w3.org>
Dear Martin (cc xproc-dev),

Thank you for the pointer to <p:directory-list>. This works, and I like
that it's pure XProc:

  <p:directory-list name="filenames" path="modules"/>
  <p:variable name="modules"
    select="(descendant::*/@name => tail()) ! substring-before(., '.xsl') !
substring-after(., 'verb-')">
  </p:variable>
  <p:identity message="{$modules}"/>

tail() gets rid of the entry for the modules directory itself.

Best,

David


On Fri, Nov 6, 2020 at 11:10 AM Martin Honnen <martin.honnen@gmx.de> wrote:

> Am 06.11.2020 um 16:55 schrieb David Birnbaum:
>
> >
> > I am stuck in (at least) two places when I attempt to move this logic
> > into XProc:
> >
> > The first sticking point is that the following does not find the files
> > within the "modules" subdirectory; it returns an empty <filenames/>
> element:
> >
> >        <p:xquery name="madule-filenames">
> >          <p:with-input port="query">
> >            <p:inline content-type="application/xml">
> >              <filenames>{{collection("modules")}}</filenames>
> >            </p:inline>
> >          </p:with-input>
> >        </p:xquery>
>
> Does it work if you put the XQuery code in an external file referenced
> for the query port? It might just be a base URI problem.
>
> But for "pure" XProc itself use
> https://spec.xproc.org/master/head/file/#c.directory-list
>
>
>
>
>
Received on Friday, 6 November 2020 17:50:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 6 November 2020 17:50:06 UTC