Subject: Re: [xsl] How could I detect/prevent a file not found exception in document()? From: "Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 9 Feb 2019 09:31:09 -0000 |
Thanks Martin cheers T -----Original Message----- From: Martin Honnen martin.honnen@xxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, 6 February 2019 2:36 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] How could I detect/prevent a file not found exception in document()? 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How could I detect/preven, Martin Honnen martin | Thread | [xsl] How to write (existential) pr, Martin Honnen martin |
Re: [xsl] How could I detect/preven, Martin Honnen martin | Date | [xsl] How to write (existential) pr, Martin Honnen martin |
Month |