XInclude and XPointer



In yesterday's meeting, we discussed putting some credits into a
common file that could be references from page files.  I talked
about a few ways this could be done, but my favorite was using
XInclude with XPointer.  I just wasn't sure whether libxml2
supported this feature.

I'm happy to report that Daniel Veillard is made of awesome.

index.page
<page xmlns="http://projectmallard.org/1.0/";>
  <info>
    <include xmlns="http://www.w3.org/2001/XInclude";
      href="info.xml" xpointer="xpointer(*/*)"/>
  </info>
</page>

info.xml
<info xmlns="http://projectmallard.org/1.0/";>
  <license><p>Some license terms</p></license>
  <credit><name>shaunm</name></credit>
  <revision pkgversion="2.28"/>
</info>


xmllint --xinclude --format index.page
<page xmlns="http://projectmallard.org/1.0/";>
  <info>
    <license xmlns="http://projectmallard.org/1.0/";>
      <p>Some license terms</p>
    </license>
    <credit xmlns="http://projectmallard.org/1.0/";>
      <name>shaunm</name>
    </credit>
    <revision xmlns="http://projectmallard.org/1.0/"; pkgversion="2.28"/>
  </info>
</page>

Have fun.

--
Shaun




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]