title: How to pipe a here-document through a command and capture the result into a variable?
body: <p>Right now this outputs the value I need on stdout. How can I capture it into a variable so I can use it in the rest of the script? </p>
  
  <p>Requirements:</p>
  
  <ul>
  <li>The script needs to be all in one file.</li>
  <li>I'd prefer not to write any temp files, if possible.</li>
  </ul>
  
  <p>.</p>
  
  <pre><code>#!/bin/bash
  
  cat &lt;&lt; EOF | xsltproc - ../pom.xml | tail -1
  &lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:template match="/"&gt;&lt;xsl:value-of select="/project/version"/&gt;&lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  EOF
  </code></pre>