Subject: Re: [xsl] check with XSL if a file is available From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 7 Jul 2003 15:38:24 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] check with XSL if a file , Jeni Tennison | Thread | [xsl] Finding the "correct" context, Ericsson, Mikael |
RE: [xsl] number total of page, a.robert21@xxxxxxxxx | Date | RE: Is XML a Language? (was RE: [xs, Didier PH Martin |
Month |