Dyluck Dyluck - 1 year ago 66
HTML Question

XPath to prepend string to each returned string?

I'm trying to work with XPath. I am using an XPath tool in which I do not have the ability to programmatically resolve this issue and hope there is simply an XPath syntax to deal with this.

I have an XPath like this:


which of course lists out all the URLs of the matching elements.
What I do need to do is append the domain name to the front of each listed match as the returned url is relative.

I've tried
but it says syntax is wrong or it only gives me the first match. I need it to return each match with the appended domain name.

Answer Source

XPath 1.0

You're out of luck if you cannot further process the returned list of strings.

XPath 2.0

Append /concat('domain', .) to the end of your XPath to prepend 'domain' to each result.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download