[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xslt2: Retrieving a directory's non-XML file names

Subject: Re: xslt2: Retrieving a directory's non-XML file names
From: Yves Forkl <Y.Forkl@xxxxxx>
Date: Wed, 01 Oct 2008 14:31:08 +0200
Re:  xslt2: Retrieving a directory's non-XML file names
So how to obtain the list of .txt files from my directory in XSLT 2?

Andrew Welch wrote:


you could try this:

http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200607/msg00570.html

....should work fine.

Thank you both for your helpful suggestions. I especially like yours, Andrew (actually based on a suggestion from Michael back in 2006...), as it spares me from developing an extension function on its own. Using the Java IO lib, however, is fine for me, as I don't plan to move away from Saxon anytime in the near future.


With the desired filter for .txt files added, my minimally Java-based XSLT 2 solution reads:

xmlns:File="java:java.io.File"

...

<xsl:variable name="txt_files"
  select="for $filename in File:list(File:new($myDir))
            return $filename[matches(., '\.txt$')]"/>


Someone else might perhaps prefer doing the filtering in Java, too.


Yves

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.