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 / F32360_testImprovedDiff.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-20  |  2.1 KB  |  65 lines

  1. <xsl:stylesheet version="1.0" 
  2. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:myFunction="myFunction" 
  4. exclude-result-prefixes="xsl myFunction"
  5. >
  6.   <xsl:import href="improvedDiff.xsl"/>
  7.   
  8.   <!-- To be applied on any source xml -->
  9.  
  10.   <myFunction:myFunction/>
  11.   
  12.   <xsl:output indent="yes" omit-xml-declaration="yes"/>
  13.   
  14.   <xsl:template match="/">
  15.     <xsl:variable name="vMyFun" select="document('')/*/myFunction:*[1]"/>
  16.     f  = x^2
  17.     x  = 15
  18.     h0 = 0.1
  19.     EpsRough    =  0.0001
  20.     EpsImproved =  0.000000000001
  21.     f'(x)       = <xsl:text/>    
  22.     <xsl:call-template name="improvedDiff">
  23.         <xsl:with-param name="pFun" select="$vMyFun"/>
  24.         <xsl:with-param name="pX" select="15"/>
  25.         <xsl:with-param name="pH0" select="0.1"/>
  26.         <xsl:with-param name="pEpsRough" select="0.0001"/>
  27.         <xsl:with-param name="pEpsImproved" select="0.000000000001"/>
  28.     </xsl:call-template>
  29.     
  30.     f  = x^2
  31.     x  = 0.5
  32.     h0 = 0.1
  33.     EpsRough    =  0.0001
  34.     EpsImproved =  0.0000000000001
  35.     f'(x)       = <xsl:text/>    
  36.     <xsl:call-template name="improvedDiff">
  37.         <xsl:with-param name="pFun" select="$vMyFun"/>
  38.         <xsl:with-param name="pX" select="0.5"/>
  39.         <xsl:with-param name="pH0" select="0.1"/>
  40.         <xsl:with-param name="pEpsRough" select="0.0001"/>
  41.         <xsl:with-param name="pEpsImproved" select="0.0000000000001"/>
  42.     </xsl:call-template>
  43.     
  44.     f  = x^2
  45.     x  = 6
  46.     h0 = 0.1
  47.     EpsRough    =  0.0001
  48.     EpsImproved =  0.0000000000001
  49.     f'(x)       = <xsl:text/>    
  50.     <xsl:call-template name="improvedDiff">
  51.         <xsl:with-param name="pFun" select="$vMyFun"/>
  52.         <xsl:with-param name="pX" select="6"/>
  53.         <xsl:with-param name="pH0" select="0.1"/>
  54.         <xsl:with-param name="pEpsRough" select="0.0001"/>
  55.         <xsl:with-param name="pEpsImproved" select="0.0000000000001"/>
  56.     </xsl:call-template>
  57.   </xsl:template>
  58.   
  59.   <xsl:template name="myFunction" match="*[namespace-uri()='myFunction']">
  60.      <xsl:param name="pParam" select="/.."/>
  61.      
  62.      <xsl:value-of select="$pParam * $pParam"/>
  63.   </xsl:template>
  64.  
  65. </xsl:stylesheet>