Subject: RE: [xsl] handling failed document() invocations From: bibhaker.saran@xxxxxxxxxx Date: Thu, 31 Oct 2002 09:53:35 +1100 |
Hi All, Reading this thread, I understand that my problem is related, which was posted as "xpath expression validity?" How do I handle the failed document() or invalid XPath expression error? I am using XSL only with MSXML4, Xercers-J (1.4.4 or others if recommended) and XMLSpy v5 Thanks Bibhakar Saran _________________________ B2B Technical Architect TXU IT Architecture & Planning Level 15 452 Flinders St, Melbourne Phone : (+61 3) 9229 6151 Mobile: 0411 203036 Email: bibhaker.saran@xxxxxxxxxx "Michael Kay" <michael.h.kay@xxxxxxxxxxxx To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > cc: Sent by: Subject: RE: [xsl] handling failed document() owner-xsl-list@xxxxxxxxxxxx invocations rytech.com 30/10/2002 10:21 PM Please respond to xsl-list > > The problem is there may not be a document there, which is an > OK state of affairs. What is the xsl code idiom for > detecting when document() is unable to find a document at the > given location, and to handle this in a more meaningful way > than exiting on error? > > If it matters I'm using saxon 6.5.2. > The XSLT 1.0 spec says that the implementation can choose whether to fail when document() can't find anything, or to recover by returning an empty node-set. Unfortunately this doesn't really help you write portable code. In Saxon you can set the error handling options from the command line: -w0 recovers silently from recoverable errors -w1 (the default) gives a warning and then recovers -w2 gives a fatal error You can also control it from the API. This is a global switch that applies to all errors; you could also try to write a JAXP ErrorListener that handles the specific error. Another approach is to write your own URIResolver that finds the document, it can return a dummy document if nothing is found. This is probably the most portable solution. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ********************************************************************************************** This email and any files transmitted with it may be confidential and are intended solely for the use of the individual or entity to whom they are addressed. Any confidentiality is not waived or lost because this email has been sent to you by mistake. This email may contain personal information of individuals, and be subject to Commonwealth and/or State privacy laws in Australia. This email is also subject to copyright. If you are not the intended recipient, you must not read, print, store, copy, forward or use this email for any reason, in accordance with privacy and copyright laws. If you have received this email in error, please notify the sender by return email, and delete this email from your inbox. ************************************************************************************TXUAU XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] handling failed document(, Andrew Welch | Thread | RE: [xsl] handling failed document(, Jarno . Elovirta |
[xsl] re-printing xml, Blaise, Isaac J | Date | RE: [xsl] String Manipulation - Dis, Conal Tuohy |
Month |