[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Fallback from document() error


Subject: [xsl] Fallback from document() error
From: Miloslav Nic <nicmila@xxxxxxxxx>
Date: Wed, 03 Jan 2001 12:08:50 +0100

Being quite often plagued by problems with 
document('foo.xml') function when foo() does not exist
I was wandering about means how to solve it.

XSLT1.1 draft still says:
 If there is an error retrieving the resource, then the XSLT processor
may signal an error; if it does not signal an error, it must recover by
returning an empty node-set. 

So you will either get an error from the processor or 
you will be unable to distinguish if the file is missing
or there is no required node in the retrieved document.

It looks to me that such problems would solve if
xsl:fallback is permited as a child of 
elements wite select attribute (e.g. apply-templates)


e.g.:

<xsl:apply-templates select="document('no-file.xml')">
	<xsl:fallback>
              The file does not exist
        </xsl:fallback>
</xsl:apply-templates>


I think that it would also circumvent problems with old processors when
there is a new vesions of XPath and the 
stylesheet would  otherwise parsed without problems not to be there a
"wrong" new XPath.


Is there some flaw in this argument?


-- 
******************************************
<firstName> Miloslav </firstName>    
<surname>   Nic      </surname>     

<mail>    nicmila@xxxxxxxxx    </mail>   
<support> http://www.zvon.org  </support>
<zvonMailingList> 
    http://www.zvon.org/index.php?nav_id=4 
</zvonMailingList>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords