Question
I have an XInclude
that includes a node-set resulting from the specified xpointer
attribute's expression.
Is it possible to select, with the xpointer
, an empty node-set, so to not include anything?
Issue
The reason is that my xincluded & xpointed node could exist and could NOT exist; so I'm getting a:
XInclude error : XPointer evaluation failed
in the case the pointed node does not exist.
Example
The expression is something like:
xmlns(ns=urn:my:namespace)
xpointer(/ns:element1/*[ns:elementA | ns:elementB])
I would like to change the XPointer so that the XInclude does NOT include anything (without raising the error) in the case the node is not found.
Something like:
xmlns(ns=urn:my:namespace)
xpointer(/ns:element1/*[ns:elementA | ns:elementB | NOT_FOUND_NODES ])
Is there any way to accomplish that?
Did you try to use xi:fallback instruction ?
For example, if you instruct this
and xpointer resource doesn't exists you will get a resource error (as express in xpointer specification). To avoid this, you can use fallback:
so when xpointer will fall in resource error, fallback will insert NOT_FOUND_NODES element