Xpath: Select attribute of parent foreach child

Hello,

I have recently started using Knime and would appreciate for any help. And I’m apologizing in advanced for my english because it’s not my native language.

Before I have created this topic I looked into some XPath tutorials (youtube, w3school) but I couldn’t find a solution or I don’t know what I’m doing wrong.

My problem is, that I want to select an attribute of a parent foreach child.
What I mean with this is that I want to create a table where in the first column is e.g. the name of the brand and in the second one are the models.

I made an example XML file for my problem:
test xml

What I want to get:
goal solution

What I get currently for exmaple:
current solution

My current Workflow and the XML file are in the following file:
XML Test.knar (15.3 KB)

I’m thankful for any help.

Regards,
Musti

hi @Mu5ti
My suggestion:

  • the first “Xpath” splits the orginal XML into “brand nodes”
    immagine

  • the second one extracts brand and models from each brand node
    immagine
    result:
    immagine

  • the “Missing Value” node replaces missing values with previous ones
    Result
    immagine

Test.knwf (13.5 KB)

3 Likes

Hello @duristef
It worked on my Problem. Thank you for your help :slight_smile:

1 Like

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