XPath: Standardmäßig 'Knoten A', wählen Sie stattdessen 'Knoten B', wenn 'Knoten B' nicht leer ist

Ich muss einen XPath-Ausdruck erstellen, der Folgendes bewirkt:

Gibt standardmäßig das Element innerhalb von 'NodeA' zurückGibt das Element innerhalb von 'NodeB' zurück, wenn es nicht leer ist.

Hier ist ein XML-Beispiel, damit meine Zielstruktur klar erkennbar ist (ich verwende MS InfoPath):

<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.10" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\9016384cab6148f6\manifest.xsf" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-09-07T14:19:10" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us">
<my:NodeASection>
    <my:NodeA>2012-09-13</my:NodeA>
</my:NodeASection>
    <my:NodeBSection>
        <my:NodeBGroup>
            <my:NodeB>2012-09-14</my:NodeB>
        </my:NodeBGroup>
    </my:NodeBSection>
</my:myFields>

Mit diesem XPath-Ausdruck kann NodeB auf das Vorhandensein von Text überprüft werden:boolean(//my:NodeB[(text())])

Ich habe von der "Becker-Methode" gehört, bin mir aber nicht sicher, wie das funktioniert, wenn beide Knoten existieren. Ich binsehr Neu bei XPath und danke für jede Hilfe, die angeboten werden kann.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage