Hi

I'm having trouble using xpointer with an xinclude.

Below is an extract of my xml file

<?xml version="1.0"?>
<card
  xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance";
  xsl:noNamespaceSchemaLocation="shema.xsd"
  xmlns:xi="http://www.w3.org/2001/XInclude";>

.....

<xi:include href="control.xml" xpointer="element(/1/1)"/>

......

</card>

control.xml

<?xml version="1.0"?>
<root>
<control>
    <id>8</id>
    <name>ValidHd</name>
    ......
</control>
</root>

and I validate it with

xmllint --valid --xinclude --schema schema.xsd Xpointer.xml

and that works fine. But when I change the xinclude to

<xi:include href="control.xml" xpointer="xpointer(//control[../name =
'ValidHd'])"/>

to try and include the control element by name so it's more robust I get
the error message "Xpointer.xml:152: element include: Schemas validity
error : Element '{http://www.w3.org/2001/XInclude}include': This element is
not expected. Expected is ( control ).
Xpointer.xml fails to validate"

And you can see in the output that it hasn't substituted any code in for
the xinclude.

What should I be doing?
Is it possible to include elements like this? The name element is unique
within the control.xml document, which is why I thought I would be able to
include it this way.

Thank you
Stuart.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to