question

zbrock avatar image
zbrock asked ericnute edited

xpath substitution

There have been a few threads on this and i can get this to work if it were not for the " ' " characters i need to preserve, i can't substitute in this xpath for the life of me;

 

(mapped/Tabular/PORT_THROUGHPUT_SUMMARY/table/row[Port='23']/BitRate_Rx)[1]

 

where 23 is the value i want to substitute. I've tried several things including this

 

(mapped/Tabular/PORT_THROUGHPUT_SUMMARY/table/row[Port=\'${aggPort1}\']/BitRate_Tx)[2]

 

with no luck. Any suggestion appreciated.

iTestxpath
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
dclaar avatar image
dclaar Suspended answered dclaar Suspended posted

Not sure what's going wrong for you, or what you're trying to do. Are you trying to substitute one query into another? Or is this a variable, and you're trying this in a test case?

 

It looks like you have the little "F" off (that's the gray box on the left), so that it doesn't interpret the square brackets as functions. But this also makes it not substitute variables. So you have to click on the gray box, so that it becomes an "f", and then escape your square brackets, too:

 

(mapped/Tabular/PORT_THROUGHPUT_SUMMARY/table/row\[Port=\'${aggPort1}\'\]/BitRate_Tx)\[2\]

 

But I'm kinda just guessing based on the information given.

1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zbrock avatar image zbrock commented ·

dclaar, the grep substitution box was checked, but it looks like my last set of escape characters were not in place "\[2\]". After adding that the query works as expected, thank you very much.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.