[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

Subject: Re: check with XSL if a file is available
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 7 Jul 2003 15:38:24 +0100
xsl check if file exists
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

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.