cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Xpath and Styler - duplicate images

ClayHelberg
17-Peridot

Xpath and Styler - duplicate images

Hi Anne-



Is it possible that there are two elements that match this selector? In
other words, there might be two <image outputclass="home"> elements in
the document. In that case your selector will find them both.



In that case, you should be able to fix this by adding a predicate to
only select the first instance, like so:



(//image[outputclass="home"])[1]



HTH.



--Clay


3 REPLIES 3

Hi Adepters,

We're trying to pull an image onto a back cover using 'Elements via Xpath.'

The expression looks like this: //image[outputclass="home"]. (The element image has attribute href whose value is a path to the graphic.)

The outcome is two graphics (the same graphic twice). I think that the image is pulling and then it's href is resolving a second time for the duplication.

Anyone know how we might kill this dup?

We've looked at adding the image by Insert>Element Content, but we need the attribute specificity. The image is not positional (i.e., 1st, 2nd, Last, etc.)

Thanks for your time,

Anne


Yep - that did it with a single quote. I thought I had tested for a duplicate instance - guess I goofed the xpath 🙂

(//image[@outputclass='home'])[1]

Thanks so much for your prompt attention.

Have a great day!
Top Tags