Re: [xsl] mystery #2: testing document() without failure

Subject: Re: [xsl] mystery #2: testing document() without failure
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Sat, 13 Apr 2002 02:48:58 -0700
Hi,

So is it wrong to rely on something like (if processor independence is important):

<xsl:variable name="test" select="document('test.xml')/test"/>
<xsl:choose>
  <xsl:when test="boolean($test)">
     <xsl:apply-templates select="$test"/>
  </xsl:when>
  <xsl:otherwise>
     <!-- error display -->
  </xsl:otherwise>
</xsl:choose>

it works in saxon.

best,
-Rob


David Carlisle wrote:


The document() function will return a null node set if the referenced
file is not found,


It might do that as an allowed recovery option but the default behaviour is to issue a (possibly fatal) error. Unfortunately there's no way to control that behaviour in XSLT itself.

xalan may have some implementation-specific customisation of this
though.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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





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


Current Thread