topical media & game development

talk show tell print

professional-xml-08-language-params.xsl / xsl



  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
          <xsl:template match="/">
                  <xsl:apply-templates select="//product">
                          <xsl:with-param name="rate" select="0.07" />
                  </xsl:apply-templates>
          </xsl:template>
          <xsl:template match="product">
                  <xsl:param name="rate" />
                  <xsl:copy>
                  <xsl:attribute name="id"><xsl:value-of select="generate-id()" /></xsl:attribute>
                  <xsl:attribute name="name"><xsl:value-of select="name" /></xsl:attribute>
                  <xsl:attribute name="priceWithTax"><xsl:value-of select="format-number(price+(price*rate), '#.00')" /></xsl:attribute>
                  </xsl:copy>
          </xsl:template>
  </xsl:stylesheet>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.