title: XPath format-number with number of decimal places based on a variable?
body: <p>I have an XML document where the number of decimal places a particular <code>xs:decimal</code> should be reported in is held in a sibling node. I'm currently struggling to find a simple way to output this via the <code>format-number</code> function.</p>
  
  <p>I can build a picture string with some other functions, but this seems terribly long-winded for what should be (at least imo) a relatively straightforward and common task.</p>
  
  <p>e.g. what I'm currently doing is something like this:</p>
  
  <pre><code>&lt;xsl:value-of
   select="format-number(myNode/DecimalValue,
           concat('#0.', 
                  string-join(for $i in 1 to myNode/DecimalPlaces return '0'))"
  /&gt;
  </code></pre>
  
  <p>Is there a better way?</p>