Quantcast
Channel: SeoTools for Excel - Community - Latest topics
Viewing all articles
Browse latest Browse all 1126

XPath: if child exists - get value, if not - write empty line

$
0
0

@chilly_bang wrote:

I have three node types: without categories, with a single category and multiple categories:

<technology>
  <categories>
    <category></category>
  </categories>
  <name></name>
</technologie>    

<technology>
  <name></name>
</technologie>    

<technology>
  <categories>
    <category></category>
    <category></category>
    <category></category>
  </categories>
  <name></name>
</technologie>

I want to write data from technology node like:

  • if there is a single category - write it,
  • if there is no category - write an empty line
  • if there are multiple categories - write the first one.

I tried //technology/categories/category[1] - it works, but partly. It fails on writing empty line in case category doesn't exist and writes all existing categories one after one.

Give me please a hint, how to write data in the outlined order.

The formula i use is:
=Dump(XPathOnUrl("https://api.builtwith.com/v12/api.xml?KEY=XXX&LOOKUP="&A2;"//technology/categories/category[1]";;;"text"))

PS: =IFERROR doesn't help too...

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 1126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>