|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing file existence
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.
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








