This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Repeating something "n" times.



 
> 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.

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]