(Q14) Variable $e is bound to some element with numeric content. Construct a new element having the same name and attributes as $e, and with numeric content equal to twice the content of $e.

LET $tagname := name($e)
RETURN
   <$tagname>
      $e/@*,   -- replicates the attributes of $e
      2 * number($e)
   </$tagname>

XSLT equivalent to (Q14)

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:variable name="e" select="/foo"/>
  <xsl:variable name="tagname" select="name($e)"/>
  <xsl:template match="/">
    <xsl:element name="{$tagname}">
      <xsl:copy-of select="$e/@*"/>
      <xsl:value-of select="2 * $e"/>
    </xsl:element>
  </xsl:template>
</xsl:transform>
<<<  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    >>>