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 / F34638_foldr.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-11-03  |  1.1 KB  |  33 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  2.  
  3.     <xsl:template name="foldr">
  4.       <xsl:param name="pFunc" select="/.."/>
  5.       <xsl:param name="pA0"/>
  6.       <xsl:param name="pList" select="/.."/>
  7.       
  8.       <xsl:choose>
  9.          <xsl:when test="not($pList)">
  10.             <xsl:copy-of select="$pA0"/>
  11.          </xsl:when>
  12.          <xsl:otherwise>
  13.  
  14.             <xsl:variable name="vFunResult">
  15.               <xsl:apply-templates select="$pFunc[1]">
  16.                 <xsl:with-param name="arg0" select="$pFunc[position() > 1]"/>
  17.                 <xsl:with-param name="arg1" select="$pList[last()]"/>
  18.                 <xsl:with-param name="arg2" select="$pA0"/>
  19.               </xsl:apply-templates>
  20.             </xsl:variable>
  21.  
  22.             <xsl:call-template name="foldr">
  23.                 <xsl:with-param name="pFunc" select="$pFunc"/>
  24.                 <xsl:with-param name="pList" select="$pList[position() < last()]"/>
  25.                 <xsl:with-param name="pA0" select="$vFunResult"/>
  26.  
  27.             </xsl:call-template>
  28.  
  29.          </xsl:otherwise>
  30.       </xsl:choose>
  31.  
  32.     </xsl:template>
  33. </xsl:stylesheet>