Dimitre's answer is good for XSLT solution, but just for completeness, here is another perspective. Since the data is in a table with a single structure, in a sense, XPath for any one element is the same when you consider the card number as a parameter. For example, in C #, the string.Format method uses {0} as a placeholder, as shown in XPATH_TEMPLATE below. Just fill in the space in this template with the card number to get the required XPath expression.
string XPATH_TEMPLATE = "//td[normalize-space(.)='{0}']/preceding-sibling::td/a"; string CardNumber = "4987 6543 2109 8769"; string XPathExpression = string.Format(XPATH_TEMPLATE, CardNumber);
The above gives this XPath expression:
So, regardless of whether you work in XSLT or C # or something else, this XPath flavor is more significant (for example, / table / tbody / tr [3] / td [1] / a), since it is autonomous with contextual information.
source share