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

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