title: XSL: Assigning the result of position() to a variable
body: <p>I am trying to assign the position of an element like this:</p>
  
  <pre><code>&lt;xsl:variable name="offset" select="ancestor::myparent/position() * 8"/&gt;
  </code></pre>
  
  <p>I am trying to show the result of the calculation in the output, so using a selector is not enough. xsltproc generates the following error:</p>
  
  <pre><code>XPath error : Invalid expression
  ancestor::myparent/position() * 8
                              ^
  compilation error: file foo.xsl line 10 element variable
  XSLT-variable: Failed to compile the XPath expression 'ancestor::myparent/position() * 8'.
  </code></pre>
  
  <p>Is there a way to do this?</p>