I have xml file, where I have many products. Not all of them I would like to use for import. By using XPATH I need to exclude from import every item, which contains specific name: lens
<items>
<item>
<id>12612991</id>
<name>Polarized Lens</name>
<description></description>
<video>link</video>
<status>expired</status>
<price>0</price>
<currency></currency>
</item>
<item>
<id>12612921</id>
<name>Polarized glass</name>
<description>asdf</description>
<video>link</video>
<status>expired</status>
<price>0</price>
<currency></currency>
</item>
</items>
I am trying to use this:
//*[not(contains(name(),'Lens'))]
So only one item from two will be imported, in this case -> Polarized glass
Also I am trying to exclude from import any items with specific ID`s
//*[not(contains(ID(),'12612921,12612926,12612924'))]
Thanks for your help.
try below XPath to get required output:
//item[not(contains(name/text(), 'Lens')) and not(id=('12612921', '12612926', '12612924'))]
If you use XPath 1.0:
//item[not(contains(name/text(), 'Lens')) and not(id='12612921') and not(id='12612926') and not(id='12612924')]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments