Sequences (Continued)

The following code defines $prices to contain a sequence of decimal values computed from the prices of each product.

<xsl:variable name="prices">
  <xsl:for-each select="$products/product">
    <xsl:choose>
      <xsl:when test="@price">
        <xsl:sequence select="xs:decimal(@price)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:sequence select="xs:decimal(@cost) * 1.5"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:variable>