Re: Repeating something "n" times.

Subject: Re: Repeating something "n" times.
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Tue, 7 Nov 2000 02:50:47 +0100
 
> given a number how do I generate a node set with that many elements?

try this:

<template name="generate-nodes"/>
  <param name="node"/>
  <param name="times"/>

  <if test="times &gt; 0">
    <copy-of select="$node"/>
    <call-template name="generate-nodes">
      <with-param name="node">
        <copy-of select="$node"/>
      </with-param>   
      <with-param name="times">
        <value-of select="$times - 1"/>
      </with-param>
    </call-template>
  </if>
</template>  

Cu,
    Goetz.

Attachment: pgp00002.pgp
Description: PGP signature

Current Thread