Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Someone correct me if I'm wrong, but I don't think this can be done with a single XPath expression. The concat function returns a single text result, not a list. I suggest you run multiple XPath expressions and construct your results from that, or run a single XPath expression to get the <code>settings</code> elements you need, then take the <code>description</code> attribute from it and concatenate it with the <code>xml:id</code> attribute from the parent element if that's a <code>control</code> one. Nodes keep references to their parents. Use method <code>getParentNode()</code> to obtain it.</p> <p>Here's an alternative: run this XPath expression...</p> <pre><code>//control[settings[@description!='-']]/@xml:id | //control/settings[@description!='-']/@description </code></pre> <p>... and then concatenate the text of the alternating results in the returned node list. In other words, text from item 0 + item 1, text from item 2 + item 3 etc.</p> <p>The above XPath expression will return this node list:</p> <pre><code>0_0 text 1 0_1 text 2 1_0 text 3 1_1 text 4 </code></pre> <p>You can then parse through that list and construct your results.</p> <p>Be careful. This will only work if there's at most 1 <code>settings</code> element per <code>control</code> element. Also, you may find that on evaluation the XPath engine throws an error for that <code>xml:</code> prefix. It may say that it's unknown. You might have to bind that prefix to the correct namespace first. Since the <code>xml</code> prefix is reserved and bound by default to a specific namespace, this might not be needed. I'm not certain as I haven't used it before.</p> <p>I've tested the expression in XMLSpy. It's not entirely impossible that the XPath engine used in Java (or the one you set for use) returns the nodes in another order. It might evaluate both parts of the "or" (the pipe symbol) separately and then dump the results into a single node list. I don't know what the XPath spec mandates regarding result ordering.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload