Ich verwende xinclude einige Teile des Dokuments in einem anderen Dokument zu enthalten, zum Beispiel in meinem Hauptdokument ich habe:XPath - wählen Sie alle Elemente mit Ausnahme Elemente (und es ist Subelemente) mit bestimmtem Attribute
<document>
<xi:include href="included.xml"
xpointer = "xpointer(*//[@condition="cond1" or not(@condition)])"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</document>
und mein included.xml wie folgt aussieht:
<root>
<chapter>
<section condition="cond1">
<para> Condition 1 Para </para>
</section>
<section condition="cond2">
<para> Condition 2 Para </para>
</section>
</chapter>
</root>
Meine Frage ist, wie kann ich alles auswählen, Beibehaltung der richtigen Struktur AUSSER Element mit Attributbedingung = „cond2“ und auch nichts davon ist Kind-Elemente? Deshalb möchte ich
<root>
<chapter>
<section condition="cond1">
<para> Condition 1 Para </para>
</section>
</chapter>
</root>
Die xpointer Ich habe wählen ist es nicht:
xpointer(*//[@condition="cond1" or not(@condition)])