Xpath question

Questions about XML that are not covered by the other forums should go here.
Posts: 1

Xpath question

Thu Dec 28, 2017 4:55 pm

I have an XML document that contains elements in one node GROUP that have attributes CLIENTID, LAST_NAME, FIRST_NAME and PREFIX_NAME. In another node CASESTEP are attributes CLIENTNAME and SCHOOLNAME. The CLIENTNAME consists of "PREFIX_NAME LAST_NAME, FIRST_NAME". For example my own name: "Van Erkel, Raymond".

Is there a way to use XPATH to search my XML file for the CLIENTID based upon the occurence of FIRST_NAME (in the one note) in CLIENTNAME (in the other note)? Also for the SCHOOLNAME. I dont't want to show the CLIENTIDs of all GROUP MEMBERS.

In the example below I want to have '123' as the result of the occurence of 'Raymond' in 'Van Erkel, Raymond'. Also 'Abc' as the result for SCHOOLNAME.



I tried contains and substring_after functions but I can't get it to work. Please help me out.
Posts: 5315

Re: Xpath question

Wed Jan 03, 2018 2:29 pm


I'm not sure I understand your entire use case, maybe you can try an XPath like this:

Code: Select all

//CLIENT_ID[contains(following-sibling::FIRST_NAME/text(), 'Raymond')]

Also as this is a generic XPath/XSLT question you have the option to write on StackOverflow about it, it's a larger community and on the Oxygen forum notifications for newly started threads are only received by us (the moderators).

Radu Coravu
<oXygen/> XML Editor

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests