<xi:include href="test3.xml"/>
This is the content of the test3.xml file.
<xi:include href="test2.xml" xpointer="xpointer(/page/content/para[2])"/>
This is paragraph 2 from test2.xml
<xi:include href="test2.xml" xpointer="xmlns(my=http://localhost/my)xpointer(/page/content/my:abc/*)"/>
This is paragraph 3 from test2.xml (inside my:abc element)
Inclusion with an invalid xpointer expression, will cause fallback element content to be inserted:
<xi:include href="test2.xml" xpointer(">
An error occured! This is the content of the fallback element you're seeing.<xi:include href="" xpointer="xmlns(xi=http://www.w3.org/2001/XInclude)xpointer(/page/content/xi:include[1])"/>
This is the content of the test3.xml file.
This sample demonstrates the recursive inclusion: here file4.xml is included, which in itself includes file5.xml:
<xi:include href="test4.xml"/>
This is content in test4.xml, will do a include of test5.xml here: This is the content of test5.xml
This example shows how you can put multiple xpointer expressions one after the other. If one doesn't return a result, it is skipped and the next one is evaluated, until one is found that returns a result.
<xi:include href="test2.xml" xpointer="xpointer(/x)xpointer(/y)xpointer(/z)xpointer(/page/content/para[2])"/>
This is paragraph 2 from test2.xml