Retrieve part of text

Jesse

I have following XPath to retrieve the sentence:

{//node/node/node/node[@class='InfoType18']/metalist/meta[@name='custom.ECO.regul1'],' (')}

Result is then:

This is a test (EU) 206/2012

I work with a dropdown menu, so the total characters of text will change. There are 2 parts: 1) The part before (EU) 206/2012 2) The part (EU) 206/2012

Problem 1: I already solved: to retrieve the text before the (EU) code:

{substring-before(//node/node/node/node[@class='InfoType18']/metalist/meta[@name='custom.ECO.regul1'],' (')}

Problem 2: I don't find a manner because I can't say: substring-before the (EU) because text length is variable.

How can I fix this issue?

Ayoub_B

Have you tried substring-after it works the same way as substring-before.

So the xPath to retrieve the part after (EU) is the following:

substring-after(//node/node/node/node[@class='InfoType18']/metalist/meta[@name='custom.ECO.regul1'],')')

And the text's length shouldn't matter in this case.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related