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

Re: Testing file existence

Subject: Re: Testing file existence
From: Steve Ball <Steve.Ball@xxxxxxxxx>
Date: Tue, 03 Sep 2002 09:15:53 +1000
tcl file test
Eduardo Andrés Alfonso Sierra wrote:
I wanna include some images in the html file generated from a xml file using
a stylesheet but I want to do that only if these images exists.

How can I test if a file (no xml) exists on my misk.

I'm using the XT processor.

For the benefit of those not using XT, there are at least two ways so solve this:

1. Use an extension function.  Most XSLT processors provide
a means of defining extensions.  Personally, I use libxslt
and have a wrapper for it for the Tcl scripting language.
To test file existence (or get a file mod time, etc)
I call out to a Tcl script via an extension function.

2. There may be other ways depending on the framework you
have set up.  For example, if you are running a web server
then you could set up a CGI(-like) URL that returns the
file existence information as a small XML document.
Then use the document() function to retrieve that info.
This is essentially a Web Service.  It would be nice to be
able to use SOAP for this purpose, but SOAP doesn't
play nicely with XSLT :-(

It goes without saying that security issues must be
considered...

2.5 Pass filesystem information to the stylesheet as
a parameter.  You could have some code create a listing
of the filesystem (most probably the sub-hierarchy you're
interested in, rather than the entire tree), pop that
in a file, pass the filename to the stylesheet as a
parameter and then use document() to pull in that file.

Just some ideas...
Steve Ball

--
Steve Ball            |   XSLT Standard Library   | Training & Seminars
Zveno Pty Ltd         |     Web Tcl Complete      |   XML XSL Schemas
http://www.zveno.com/ |      TclXML TclDOM        | Tcl, Web Development
Steve.Ball@xxxxxxxxx  +---------------------------+---------------------
Ph. +61 2 6242 4099   |   Mobile (0413) 594 462   | Fax +61 2 6242 4099


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.