Search code examples
xmldocbookxinclude

Is it possible to use wildcards with XInclude tags?


I'm afraid it's not possible, but haven't found anywhere it is said to be impossible either.

I'd like to include a set of files within a XML document using wildcards. Like this:

<?xml version="1.0" encoding="utf-8"?>
<mydocument>
  <!-- ... -->
  <xi:include href="*include.xml"/>
</mydocument>

I know it doesn't work, but I think it clearly expresses my intentions. Is there a way to achieve this?

Edit:

I tried to use xpointer attribute, but couldn't make it work.


Solution

  • Is it possible to use wildcards with XInclude tags?

    No. The href denotes a URI, and these do not have a concept of wildcards.

    Otherwise it would be possible to mirror the Google homepage by saying something like href="http://www.google.com/*".

    Hint: File systems do also not have any concept of wildcards. Shells do. They do the heavy lifting of filling in the blanks for you when they parse a path and see a *. The underlying file system never gets to see the asterisk.