XInclude, XPointer, & Oxygen: what works?
Posted: Sat Sep 20, 2008 12:23 am
I think I've read all the current posts on XInclude/XPointer, and some of the older ones; it is difficult to sort out what comments still apply today. So here's my situation -- I want to grab (import on XSL processing) the contents of Deployment in the included file below, which does not have an 'id' attribute in the schema at the moment. What is it I don't understand in XInclude, XPointer, Oxygen, or is there a better way to do this simple thing?
I'm using Oxygen 9.3, mostly with the default parser, but also with Xsltproc. I have tried about 20 ways of putting fragment/entity/pointer information into an xi:include statement, all of them copied off of allegedly working examples on the web, with only 1 success. Using xi:include without xpointers or fragments works, but I get the whole document of course; and if I use "element(/1/1/1)", this works, but is fragile of course.
With fragments like 'href=1632.xml#/Metadata", I get "Fragment identifiers must not be used."
WIth xpointer="/", "/Metadata", "//", etc., I get: "InvalidShortHandPointer: The NCName of the ShortHand Pointer '/' is invalid."
My understanding is that xpointer supports XPath patterns, but apparently I'm not grokking how to do that correctly.
My included file is '1632.xml', as follows:
My encompassing file is of the form
I'm using Oxygen 9.3, mostly with the default parser, but also with Xsltproc. I have tried about 20 ways of putting fragment/entity/pointer information into an xi:include statement, all of them copied off of allegedly working examples on the web, with only 1 success. Using xi:include without xpointers or fragments works, but I get the whole document of course; and if I use "element(/1/1/1)", this works, but is fragile of course.
With fragments like 'href=1632.xml#/Metadata", I get "Fragment identifiers must not be used."
WIth xpointer="/", "/Metadata", "//", etc., I get: "InvalidShortHandPointer: The NCName of the ShortHand Pointer '/' is invalid."
My understanding is that xpointer supports XPath patterns, but apparently I'm not grokking how to do that correctly.
My included file is '1632.xml', as follows:
Code: Select all
<Metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ourschemalocation">
<Deployment>
<Device name="TestName" />
<output>more stuff</output>
</Deployment>
</Metadata>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Metadata xsi:noNamespaceSchemaLocation="http://myschemalocation" >
<DataProducer name="2008.09.18">
<DataProducer name="Port Optode">
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="1632.xml" xpointer="/" >
<xi:fallback>
<Device name="ERROR: could not include data from 1632.xml" id="1632">
</Device>
</xi:fallback>
</xi:include>
</DataProducer>
</DataProducer>
</Metadata>