Re: [xsl] saxon:try()

Subject: Re: [xsl] saxon:try()
From: "Colin Adams" <colinpauladams@xxxxxxxxxxxxxx>
Date: Wed, 9 Jan 2008 08:07:46 +0000
On 08/01/2008, Colin Adams <colinpauladams@xxxxxxxxxxxxxx> wrote:

> >   If you want to prevent the global variable evaluation to
> > throw an error, use something like this:
> >
> >     <xsl:variable name="v" as="node()"/>
> >        <ex:error-safe>
> >           <ex:try>
> >              <xsl:sequence select="error()"/>
> >           </ex:try>
> >           <ex:catch>
 > >              <xsl:sequence select="'alternative value'"/>
> >           </ex:catch>
> >        </ex:error-safe>
> >     </xsl:variable>
>

The problem with this is that, in general, you don't know whether or
not it is right to catch the error. The accessor of the variable might
be in a different module, by a different author.

You won't always be able to guess what is best for the user of the module.

Current Thread