>> English << | По-русскиZVON > Tutorials > XInclude Tutorial
>> Example 5 << | Prev | Next | Contents

Element fallback


Description

Element fallback tells the processor, what to do in case of resource error (a failure of an attempt to fetch a resource from a URL) - non-existent file, bad connection, etc. When this happens, include element is replaced with the contents of the fallback element. The fallback must be a child of the include element. It can contain anything.

Valid example

The file a.xml tries to include non-existent file.
File a.xml:
    <a> 
     <xi:include href="non-existent.xml"
      xmlns:xi="http://www.w3.org/2001/XInclude">
      <xi:fallback>There are no files today ... </xi:fallback>
     </xi:include>
    </a>
   

File a.xml after processing:
    <a>
     There are no files today ... 
    </a>