|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: handling failed document() invocations
> > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








