XPath Axes - Preceding Sibling - Not working with selector

Hello,

I have made the following simplified XML:

<?xml version="1.0" encoding="UTF-8"?>
<dl class="test">
    <dt>Key1</dt>
    <dd>Value1</dd>
    <dt>Key2</dt>
    <dd>Value2</dd>
    <dt>Key3</dt>
    <dd>Value3</dd>
</dl>

And I would like to convert it to a table with three columns: Key1, Key2 and Key3

With the XPath node, if I use the following selector:

//dl/dd
with as XPath Query for column name:
preceding-sibling::dt

It works like a charm.

However if I add a selector to the first query, such as:
//dl[@class='test']/dd

I get the following error:

Execute failed: XPath expression cannot be compiled

I have attached a sample workflow.XpathPreceding.knwf (11.5 KB)
Can you please help me?

1 Like

Hi there @sebversailles,

XPath node support version 1.0. If your syntax requires 2.0 or higher won’t work.

Br,
Ivan

1 Like

Hello,
Thank you for your reply.
However, if you look at your workflow the difference between the working and non-working versions is so slight that it doesn’t look like a Xpath version problem.
Br

1 Like

Hi @sebversailles,

not sure. Maybe @armingrudd can help.

Br,
Ivan

1 Like

Hi @sebversailles,

Your queries are fine. There should be a problem with the node.

This issue happens when you select value elements by a specific attribute and try to assign column names by a relative path to the value query. It does not happen if you select elements by index value.

I think this behavior should be reviewed by developers at KNIME.

:blush:

2 Likes

Hi there,

ticket for this is created. (Internal reference AP-14091).

Br,
Ivan

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.