home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F32420_testImprovedIntegration.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-03-01  |  3.8 KB  |  111 lines

  1. <xsl:stylesheet version="1.0"
  2.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:IntegralFunction="IntegralFunction"
  4. xmlns:IntegralFunction2="IntegralFunction2"
  5. xmlns:IntegralFunction3="IntegralFunction3"
  6. xmlns:IntegralFunction4="IntegralFunction4"
  7.  exclude-result-prefixes="xsl IntegralFunction IntegralFunction2
  8.  IntegralFunction3 IntegralFunction4"
  9. >
  10.  
  11.   <xsl:import href="improvedIntegration.xsl"/>
  12.   
  13.   <!-- To be applied on any source xml.
  14.        Calculates the values for: 
  15.        Integral of x^2 in the interval [0,1] (1/3),
  16.        Integral of x^3 in the interval [0,1] (1/4),
  17.        Integral of 4/(1 + x┬▓)  in the interval [0,1] (Pi),
  18.        Integral of 1/x in the interval [1,2] (ln 2),
  19.        
  20.        with precision 0.0001
  21.     -->
  22.  
  23.   <xsl:output method="html" encoding="UTF-8"/>
  24.  
  25.   <IntegralFunction:IntegralFunction/>
  26.   <IntegralFunction2:IntegralFunction2/>
  27.   <IntegralFunction3:IntegralFunction3/>
  28.   <IntegralFunction4:IntegralFunction4/>
  29.  
  30.   <xsl:template match="/">
  31.   <html>
  32.    <head/>
  33.     <br /> 1
  34.     <br /><font size="5">∫</font> x² =
  35.     <xsl:variable name="vMyFun" select="document('')/*/IntegralFunction:*[1]"/>
  36.     <xsl:call-template name="improvedIntegration">
  37.       <xsl:with-param name="pFun" select="$vMyFun"/>
  38.       <xsl:with-param name="pA" select="0"/>
  39.       <xsl:with-param name="pB" select="1"/>
  40.       <xsl:with-param name="pEpsRough" select="0.001"/>
  41.       <xsl:with-param name="pEpsImproved" select="0.0001"/>
  42.     </xsl:call-template>
  43.     <br />0
  44.  
  45.     <br />
  46.     <br /> 1
  47.     <br /><font size="5">∫</font> x³ =
  48.     <xsl:variable name="vMyFun2" select="document('')/*/IntegralFunction2:*[1]"/>
  49.     <xsl:call-template name="improvedIntegration">
  50.       <xsl:with-param name="pFun" select="$vMyFun2"/>
  51.       <xsl:with-param name="pA" select="0"/>
  52.       <xsl:with-param name="pB" select="1"/>
  53.       <xsl:with-param name="pEpsRough" select="0.001"/>
  54.       <xsl:with-param name="pEpsImproved" select="0.0001"/>
  55.     </xsl:call-template>
  56.     <br />0
  57.  
  58.     <br />
  59.     <br /> 1
  60.     <br /><font size="5">∫</font> 4/(1 + x²) =
  61.     <xsl:variable name="vMyFun3" select="document('')/*/IntegralFunction3:*[1]"/>
  62.     <xsl:call-template name="improvedIntegration">
  63.       <xsl:with-param name="pFun" select="$vMyFun3"/>
  64.       <xsl:with-param name="pA" select="0"/>
  65.       <xsl:with-param name="pB" select="1"/>
  66.       <xsl:with-param name="pEpsRough" select="0.00001"/>
  67.       <xsl:with-param name="pEpsImproved" select="0.0000000000001"/>
  68.     </xsl:call-template>
  69.     <br />0
  70.  
  71.     <br />
  72.     <br /> 2
  73.     <br /><font size="5">∫</font> 1/x =
  74.     <xsl:variable name="vMyFun4" select="document('')/*/IntegralFunction4:*[1]"/>
  75.     <xsl:call-template name="improvedIntegration">
  76.       <xsl:with-param name="pFun" select="$vMyFun4"/>
  77.       <xsl:with-param name="pA" select="1"/>
  78.       <xsl:with-param name="pB" select="2"/>
  79.       <xsl:with-param name="pEpsRough" select="0.00001"/>
  80.       <xsl:with-param name="pEpsImproved" select="0.000000001"/>
  81.     </xsl:call-template>
  82.     <br />1
  83.     </html>
  84.  
  85.   </xsl:template>
  86.  
  87.   <xsl:template name="myIntegralFn" match="*[namespace-uri()='IntegralFunction']">
  88.     <xsl:param name="pX"/>
  89.  
  90.     <xsl:value-of select="$pX * $pX"/>
  91.   </xsl:template>
  92.  
  93.   <xsl:template name="myIntegralFn2" match="*[namespace-uri()='IntegralFunction2']">
  94.     <xsl:param name="pX"/>
  95.  
  96.     <xsl:value-of select="$pX * $pX * $pX"/>
  97.   </xsl:template>
  98.  
  99.   <xsl:template name="myIntegralFn3" match="*[namespace-uri()='IntegralFunction3']">
  100.     <xsl:param name="pX"/>
  101.  
  102.     <xsl:value-of select="4 div (1 + $pX * $pX)"/>
  103.   </xsl:template>
  104.  
  105.   <xsl:template name="myIntegralFn4" match="*[namespace-uri()='IntegralFunction4']">
  106.     <xsl:param name="pX"/>
  107.  
  108.     <xsl:value-of select="1 div $pX"/>
  109.   </xsl:template>
  110.  
  111. </xsl:stylesheet>