On Sat, 2009-01-31 at 08:12 +0100, Daniel Veillard wrote:
> On Thu, Jan 29, 2009 at 01:50:52PM -0800, Marc Munro wrote:
> > I am processing a document which contains nested inclusions using
> > xi:include. How can I tell the source file from which a given node was
> > included into the document?
>
> Not always possible, for example if you XInclude a text node, well
> there is little to help. But you can use 2 things:
> xml:base attribute left by the xinclude process, if you ask for the
> base at a given included point, you may get the proper URI
> if there was room left to put the base attribute at the inclusion
> point (i.e. on an element)
> the XInclude process also turns the original xi:include element into
> an XML_XINCLUDE_START node with all attributes left and also add
> an XML_XINCLUDE_END after the included element(s)
Daniel,
Thanks for this. Using this information I thought I had it cracked but
it seems that what I have done only works for a single level of nesting.
With nested inclusions, my code shows the filename for the outermost
included file. This is the code I am using to discover the URI for a
given element.
static char *
nodeLocation(xmlNode *node)
{
xmlDoc *doc = node->doc;
xmlChar *uri = xmlNodeGetBase(doc, node);
. . .
}
Am I doing something obviously wrong?
If not there may a further clue in that I have registered my own input
callbacks for finding and reading the inclusions. Would these be likely
to cause this problem?
__
Marc
Attachment:
signature.asc
Description: This is a digitally signed message part