#!/bin/sh
if [ $# -ne 2 ]
then
  echo "Usage: $0 <xml> <xpointer>" >&2
  exit 1
fi
xml=$1
xpointer=$2
tmpxml=`mktemp -t` || exit 1
echo "$xml" > "$tmpxml"
cat <<EOF | xmllint --xinclude -
<root>\
<include xmlns="http://www.w3.org/2003/XInclude"
href="$tmpxml" xpointer="xpointer($xpointer)"/>\
</root>
EOF
rm -f "$tmpxml"
