title: Converting two fields of a table in an XML file into CSV using xmllint in bash?
body: <p>I've got an XML file (converted from HTML) containing fields like this:</p>
  
  <pre><code>&lt;tr&gt;
    &lt;td data-title="Date"&gt;2018-01-01&lt;/td&gt;
    &lt;td data-title="Version"&gt;&lt;a href="https://some-link"&gt;25.1&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td data-title="Date"&gt;2018-03-01&lt;/td&gt;
    &lt;td data-title="Version"&gt;&lt;a href="https://some-link"&gt;24.1&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I've been using 'xmllint' to extract single values:</p>
  
  <pre><code>textarea=$(echo "$xml" | xmllint --xpath 'string(//*[@id="content"])' 2&gt;/dev/null )
  </code></pre>
  
  <p>and multiple values:</p>
  
  <pre><code>list=$(echo "$xml" | xmllint --xpath 'string(/html/body/div/ul)' 2&gt;/dev/null )
  </code></pre>
  
  <p>but now I want to extract two fields from each record, in CSV format or something similar.</p>
  
  <p>The closest I've got is this:</p>
  
  <pre><code>xpath tr/*[@data-title="Date" or @data-title="Version"]/text()
  Object is a Node Set :
  Set contains 20 nodes:
  1  TEXT
      content=Apr 9, 2018 6:13 PM UTC
  2  TEXT
      content=Mar 21, 2018 10:41 PM UTC
  3  TEXT
      content=Mar 19, 2018 9:22 PM UTC
  </code></pre>
  
  <p>Can you show me a way to achieve this with a better xpath?</p>