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 / F39406_buildListUntil.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-02-06  |  2.5 KB  |  67 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:xalan="http://xml.apache.org/xalan"
  3. exclude-result-prefixes="xsl xalan"
  4. >
  5.   <xsl:template name="buildListUntil">
  6.     <xsl:param name="pGenerator" select="/.."/>
  7.     <xsl:param name="pController" select="/.."/>
  8.     <xsl:param name="pParam0" select="/.."/>
  9.     <xsl:param name="pParamGenerator" select="/.."/>
  10.     <xsl:param name="pElementName" select="'el'"/>
  11.     <xsl:param name="pList" select="/.."/>
  12.  
  13.     <xsl:if test="not($pController)">
  14.       <xsl:message terminate="yes">
  15.       [buildListUntil]Error: No pController specified:
  16.          would cause infinite processing.
  17.       </xsl:message>
  18.     </xsl:if>   
  19.     
  20.     <xsl:variable name="vElement">
  21.       <xsl:element name="{$pElementName}">
  22.       <xsl:apply-templates select="$pGenerator">
  23.         <xsl:with-param name="pParams" select="$pParam0"/>
  24.         <xsl:with-param name="pList" select="$pList"/>
  25.       </xsl:apply-templates>
  26.       </xsl:element>
  27.     </xsl:variable>
  28.     
  29.     <xsl:variable name="newList">
  30.       <xsl:copy-of select="$pList"/>
  31.       <xsl:copy-of select="xalan:nodeset($vElement)/*"/>
  32.     </xsl:variable>
  33.     
  34.     <xsl:variable name="vResultList" select="xalan:nodeset($newList)/*"/>
  35.     
  36.     <xsl:variable name="vShouldStop">
  37.       <xsl:apply-templates select="$pController">
  38.         <xsl:with-param name="pList" select="$vResultList"/>
  39.         <xsl:with-param name="pParams" select="$pParam0"/>
  40.       </xsl:apply-templates>
  41.     </xsl:variable>
  42.     
  43.     <xsl:choose>
  44.       <xsl:when test="string($vShouldStop)">
  45.         <xsl:copy-of select="$vResultList"/>
  46.       </xsl:when>
  47.       <xsl:otherwise>
  48.         <xsl:variable name="vNewParams">
  49.           <xsl:apply-templates select="$pParamGenerator">
  50.             <xsl:with-param name="pList" select="$vResultList"/>
  51.             <xsl:with-param name="pParams" select="$pParam0"/>
  52.           </xsl:apply-templates>
  53.         </xsl:variable>
  54.         
  55.         <xsl:call-template name="buildListUntil">
  56.             <xsl:with-param name="pGenerator" select="$pGenerator"/>
  57.             <xsl:with-param name="pController" select="$pController"/>
  58.             <xsl:with-param name="pParam0" select="xalan:nodeset($vNewParams)/*"/>
  59.             <xsl:with-param name="pParamGenerator" select="$pParamGenerator"/>
  60.             <xsl:with-param name="pElementName" select="$pElementName"/>
  61.             <xsl:with-param name="pList" select="$vResultList" />
  62.         </xsl:call-template>
  63.       </xsl:otherwise>
  64.     </xsl:choose>
  65.   </xsl:template>
  66.  
  67. </xsl:stylesheet>