[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
There is no way to do that in standard XSLT. A system is _allowed_ not to error on a missing file, and if it does not error, then it must return an empty node set, and your test will work. If however it does error (and your system seems to), you have no way to recover. Since you are (presumably) using xalan inside cocoon you can use xalan's extension functions to eg this (which uses saxon's interface to java, but xalan has something similar I think) <xsl:template name="file-exists-p" xmlns:file="java.io.File"> <xsl:param name="filename" select="'x'"/> <xsl:value-of select="file:exists(file:new($filename))"/> </xsl:template> An alternative is to customise your URI resolver classes in Java so that they don't error on a missing file, but instead return some standard XML file that you can test for. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ 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
|