Re: [xsl] How to read an XML file that is in a subfolder or sub-subfolder or sub-sub-subfolder or ...?

Subject: Re: [xsl] How to read an XML file that is in a subfolder or sub-subfolder or sub-sub-subfolder or ...?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Apr 2020 14:59:16 -0000
Roger,

In Saxon, also, when consuming a path to a directory, the collection()
function accepts a 'recurse' option, which could be used to return
such a file.

collection('file:///path/to/files?recurse=yes;select=filelist.xml')

Of course you might get more than one filelist.xml this way.

Cheers, Wendell


On Tue, Apr 7, 2020 at 9:14 AM Michael Kay mike@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Assuming your processor can map a file system directory to a collection, you can use the fn:uri-collection() function to get all the URIs of files in the collection and then search them to find the one you are looking for.
>
> An alternative would be to use the functions in the EXPath file module, which gives explicit access to concepts like folders and files.
>
> Michael Kay
> Saxonica
>
> On 7 Apr 2020, at 14:06, Costello, Roger L. costello@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Folks,
>
> My XSLT program has a variable $filename which contains the name of an XML file. The XML file is in a folder named "files" or one of its subfolders or one of its sub-subfolders or one of its sub-sub-subfolders or ...
>
> In other words, it's somewhere in the tree of folders rooted at "files."
>
> I want to open the XML file (wherever it's located within "files") and read it into an XSLT variable. Is there a way to do this?
>
> /Roger
>
>
> XSL-List info and archive
> EasyUnsubscribe (by email)



-- 
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...

Current Thread