C
C
Chichi2015-05-03 09:34:06
Parsing
Chichi, 2015-05-03 09:34:06

How to concatenate string and url attribute value in Xpath?

Using Xpath, I want to concatenate this string: "/images/products/"
and the url attribute values ​​in the following code snippet:

<div id="small-images">
    <ul>
       <li url="1.jpeg"></li>
       <li url="2.jpeg"></li>
       <li url="3.jpeg"></li>
    </ul>
    </div>

I would like to get this result:
/images/products/1.jpeg
/images/products/2.jpeg
/images/products/3.jpeg
Tried to do this:
concat(//div[@id="small-images"] /li/@url, '/images/products/')
and so:
string-join(//div[@id="small-images"]/li/@url, "/images/products/")
Doesn't work .
How to concatenate string and result url attribute in Xpath?
Update: In general, as I understand this problem, there is no solution without writing additional plugins and dancing with a tambourine

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Vsk, 2015-05-03
@ChicoId

What do you mean it doesn't work? Have you looked at what your selector returns? Is it really the right URL value?
You need either this
or that
There is no element you are looking for, because you are looking for li in immediate descendants (and there is also ul first)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question