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 / F41776_take.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-02-06  |  2.0 KB  |  51 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:take-controller="take-controller"
  3. xmlns:take-dynamic-controller="take-dynamic-controller"
  4. exclude-result-prefixes="xsl"
  5. >
  6.   <xsl:import href="buildListWhile.xsl"/>
  7.   <take-controller:take-controller/>
  8.   <take-dynamic-controller:take-dynamic-controller/>
  9.  
  10.   <xsl:template name="take">
  11.     <xsl:param name="pList" select="/.."/>
  12.     <xsl:param name="pN" select="0"/>
  13.     <xsl:param name="pGenerator" select="/.."/>
  14.     <xsl:param name="pParam0" select="/.."/>
  15.     <xsl:param name="pParamGenerator" select="/.."/>
  16.     <xsl:param name="pElementName" select="'el'"/>
  17.     
  18.     <xsl:variable name="vTakeController" select="document('')/*/take-controller:*[1]"/>
  19.     <xsl:variable name="vTakeDynController" select="document('')/*/take-dynamic-controller:*[1]"/>
  20.  
  21.     <xsl:choose>
  22.       <xsl:when test="$pList">
  23.         <xsl:copy-of select="$pList[position() <= $pN]"/>
  24.       </xsl:when>
  25.       <xsl:when test="$pGenerator">
  26.           <xsl:call-template name="buildListWhile">
  27.                 <xsl:with-param name="pList" select="/.."/>
  28.                 <xsl:with-param name="pGenerator" select="$pGenerator"/>
  29.                 <xsl:with-param name="pController" select="$vTakeDynController"/>
  30.                 <xsl:with-param name="pContollerParam" select="$pN"/>
  31.                 <xsl:with-param name="pParam0" select="$pParam0"/>
  32.                 <xsl:with-param name="pParamGenerator" select="$pParamGenerator"/>
  33.                 <xsl:with-param name="pElementName" select="$pElementName"/>
  34.           </xsl:call-template>
  35.       </xsl:when>
  36.     </xsl:choose>
  37.   </xsl:template>
  38.  
  39.   <xsl:template name="takeController" match="*[namespace-uri()='take-controller']">
  40.      <xsl:param name="pParams"/>
  41.      
  42.      <xsl:if test="$pParams > 0">1</xsl:if>
  43.   </xsl:template>
  44.   
  45.   <xsl:template name="takeDynController" match="*[namespace-uri()='take-dynamic-controller']">
  46.      <xsl:param name="pList"/>
  47.      <xsl:param name="pParams"/>
  48.      
  49.      <xsl:if test="$pParams >= count($pList)">1</xsl:if>
  50.   </xsl:template>
  51. </xsl:stylesheet>