[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] check with XSL if a file is available
Subject: Re: [xsl] check with XSL if a file is available From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 7 Jul 2003 15:26:24 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] check with XSL if a file is a, Joel Fisler | Thread | Re: [xsl] check with XSL if a file , David Carlisle |
RE: [xsl] number total of page, David . Pawson | Date | RE: Is XML a Language? (was RE: [xs, Michael Kay |
Month |
Keywords