[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How could I detect/prevent a file not found except

Subject: Re: How could I detect/prevent a file not found exception in document()?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Feb 2019 13:35:29 -0000
Re:  How could I detect/prevent a file not found except
On 05.02.2019 14:21, Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx wrote:

A set of templates which are used to fill in the clickable text of a cross-reference are occasionally failing for me with a "file not found" exception. The processor we are using for this is Saxon but I'm hoping that there may be a way to code round the problem that is not processor-specific, so I am posting the relevant part of it here rather than on the Saxon list.

The stylesheet containing these templates is currently XSL 1.0 because an extensive array of stylesheets include it, and some of them have to be XSL 1.0. But I could easily do a separate XSL 2.0 version if that helped avoid this issue.

In general Saxon 9 supports the function doc-available, like any other processor supporting XSLT/XPath 2 and later so using e.g.



<!-- can't find the file/id, so need a bit of magic: use the cache document from the previous build -->

<xsl:otherwise>

<xsl:variable name="cachefile">

<xsl:call-template name="cache-filename">

<xsl:with-param name="pathname" select="$linkfile" />

</xsl:call-template>

</xsl:variable>

<xsl:variable name="cachedlink">

<!-- doc TWO -->

<xsl:if test="doc-available($cachefile)">


<xsl:for-each select="document($cachefile,/)">

might help.


With Saxon 9.8 or 9.9 and XSLT 3 you would also be able to use `xsl:try/catch"

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.