[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: check with XSL if a file is available
Hi Joel, > i want to implement a choose statment that defines what to do if a > document is available and what to do if this document is not > available. Processors are allowed to do one of two things when you tell them to access a document that doesn't exist: they can generate an error, or they can return an empty node set. You're obviously using a processor that does the former rather than the latter. One solution would be to switch to using a processor that does the latter, if you can find one. A better solution (since you will then be able to use any processor) would be to use another method to work out whether the file is available or not. Since you're using Cocoon, one way you can do this is to make available a directory listing, as XML, using the Directory Generator (see http://cocoon.apache.org/2.1/userdocs/generators/directory-generator.html). For example, if you set it up in the sitemap so that the URL "path/_dir" gave you a directory listing for the directory found at "path" then you could do something like: <xsl:choose> <xsl:when test="document('path/_dir')/dir:directory/dir:file/@name = 'path/filename.xml'"> do this with the file </xsl:when> <xsl:otherwise> do something else without the file </xsl:otherwise> </xsl:choose> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ 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
|