title: why can't I navigate using the child element in this xpath expression?
body: <p>In XSL 2.0, I'm trying to iterate through some data by the distinct values, and then do something with them.</p>
  
  <pre><code>&lt;xsl:for-each select="distinct-values(InvoiceLine/Service/ServiceMnemonicCode)"&gt;                
    &lt;xsl:variable name="mnemonic"&gt;
      &lt;xsl:value-of select="."/&gt;
    &lt;/xsl:variable&gt;
          &lt;fo:table-row&gt;
              &lt;fo:table-cell&gt;
                  &lt;fo:block&gt;
  &lt;xsl:value-of select="InvoiceLine/Service[ServiceMnemonic=$mnemonic]/ServiceDescription"/&gt;                      
                  &lt;/fo:block&gt;
              &lt;/fo:table-cell&gt;
          &lt;/fo:table-row&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>However I end up with the following error:</p>
  
  <pre><code>XPTY0020: Axis step
   child::element({http://schemas.blabla.com/etp/invoice/types}InvoiceLine, xs:anyType)
   cannot be used here: the context item is an atomic value
  ailed to compile stylesheet. 1 error detected.
  </code></pre>
  
  <p>I've bee googling furiously, and I do see people complaining about "atomic values" but I haven't seen anyone suggest what to do about it. I've using Saxon9. Any insight would be greatly appreciated.</p>