<!---->
<xsl:stylesheet xmlns:loop="http://informatik.hu-berlin.de/loop" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:variable name="list" select="//book" />
<xsl:variable name="total" select="0" />
<loop:while test="$list">
<xsl:variable name="first" select="$list[1]" />
<loop:last>
<xsl:text>Total sales value is: </xsl:text>
<xsl:value-of select="format-number($total,'$#.00')" />
<xsl:text>
</xsl:text>
</loop:last>
<loop:update name="list" select="$list[position()!=1]" />
<loop:update name="total" select="$first/sales * $first/price + $total" />
</loop:while>
</xsl:template>
</xsl:stylesheet>