Xpath fb6

Hi,

I'm having a problem itarating (with FB6) through a specific csproj file.

In the attached example I would like to get only the attributes that starts with the word TEST.

Cheers,

Ranch.

 

 

Hi Ranch

 
I have attached a brief example that demonstrates how to do this. I had to modify you file a little as it was not valid xml.
 
I have used the 'starts-with' function within the XPath string to select on nodes where the Include attribute starts with 'TEST'.
 
Hope this helps.
 
Regards,
Steve
XpathExample.zip (2.496 KB)

Hi Steve,

Thank you, that helped a lot.

Just a fine tuning for my question: How can I get just the first value of the attribute (TEST.1234.ABCD)?

Cheers,

Ranch.

I have updated my example which now uses the Text Find action with a Regular Expression to extract the desired part of the attribute value into its own variable.

Hope this helps.

Regards,
Steve

xPathExampleUpdated.zip (3.432 KB)

Hi Steve,

Thank you again for the quick and detailed response.

Cheers,

Ranch.

No problems, I forgot to mention in my previous post that the Regular Expression in the example is tailored to the sample values included in the file you provided. You may need to change the regex statement to be more dynamic for use in your actual build script.

Regards,
Steve

I noticed that, and made the needed adjustment.

btw - what should I write in the Regular Expression when part of the string in a combination of text and numbers?

exp':

TEST.ABCD.ABCD

TEST.ABCD.ABCD

TEST.ABCD1234

TEST.ABCD.ABCD

Just find the third string and ignoring the others?

Cheers,

Ranch.

If it is always going to be in this format you can use: TEST.[A-z]{4}[0-9]{4}

Here is the reference i use for Regular Expressions: http://www.regular-expressions.info/

Regards,
Steve

Thank you!

Cheers,

Ranch.