Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 14th, 2007, 05:28 AM
Authorized User
 
Join Date: Apr 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Print directory file names in a loop

I have seen in an older thread how to check for the existence of a file using boolean(document()) and whys this might not work in all cases.

In my scenario I would like to check for the existence of a folder and then iterate through its contents (basically print the file names in a loop).

Is that possible with XSLT 1.0..?

 
Old May 14th, 2007, 05:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>In my scenario I would like to check for the existence of a folder and then iterate through its contents (basically print the file names in a loop). Is that possible with XSLT 1.0..?

No, not directly. There's no standard facility in XSLT 1.0 to access the contents of a folder.

The usual recommendation is to convert the directory listing into XML form in the calling application, and then pass it as a parameter (or even as the primary input) to the stylesheet, which can access the individual documents using the document() function.


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 14th, 2007, 05:47 AM
Authorized User
 
Join Date: Apr 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for your prompt reply :)

I will do just that and use document() for every file, as you have described in an older thread.






Similar Threads
Thread Thread Starter Forum Replies Last Post
UserType Variables--loop thru their names? Paul Gerken VB How-To 10 December 4th, 2006 01:08 PM
loop through a XML document and print out crmpicco Perl 1 November 13th, 2006 08:51 AM
Getting form element names in a loop crapanz Javascript 5 January 30th, 2006 12:45 AM
Print and print preview file on the website withou appleLover General .NET 0 February 19th, 2005 02:24 AM
reading file names riteshu C++ Programming 3 September 22nd, 2004 05:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.