XInclude using urn with multiple colons

135 views Asked by At

Based off of How to use xpointer with Xinclude to reference elements ...

I am having issues including a nested element using xpointer when the namespace urn contains multiple colons.

Test1.xml

<?xml version="1.0" encoding="UTF-8"?>

<Root xmlns="urn:some:namespace">
  <element1 id="001">
    <element2 id="001.1" order="1">
      <element3 id="001.1.1"/>
    </element2>
    <element2 id="001.2" order="2">
      <lement3 id="001.1.2"/>
    </element2>
  </element1>
</Root>

Test2.xml

<?xml version="1.0" encoding="UTF-8"?>

<Root>
  <element1 id="999">
    <element2 id="999.1" order="1">
      <element3 id="999.1.1"/>
    </element2>
  </element1>
</Root>

Merge.xml

<?xml version="1.0"?>

<Root xmlns:xi="http://www.w3.org/2003/XInclude">

  <xi:include href="Test1.xml" xpointer="xmlns(ns=urn:some:namespace)xpointer(/ns:Root/ns:element1)" parse="xml" />
  <xi:include href="Test2.xml" xpointer="xpointer(//Root/element1)" parse="xml" />

</Root>

Command:

xmllint --pretty 1 --xinclude Merge.xml

ERROR

Merge.xml:5: element include: XInclude error : XPointer evaluation failed: #xmlns(ns=urn:some:namespace)xpointer(/ns:Root/ns:element1)
Merge.xml:5: element include: XInclude error : could not load Test1.xml, and no fallback was found
0

There are 0 answers